Skip to content

Commit 4a9f89f

Browse files
authored
Update __init__.py
Signed-off-by: Kenechukwu Akubue <kengoon19@gmail.com>
1 parent 7473a2c commit 4a9f89f

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

pythonforandroid/recipes/sdl3_image/__init__.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,25 @@ def get_include_dirs(self, arch):
2929
def prebuild_arch(self, arch):
3030
# We do not have a folder for each arch on BootstrapNDKRecipe, so we
3131
# need to skip the external deps download if we already have done it.
32-
external_deps_dir = os.path.join(
33-
self.get_build_dir(arch.arch), "external"
34-
)
35-
if not os.path.exists(os.path.join(external_deps_dir, "libwebp")):
36-
with current_directory(external_deps_dir):
37-
shprint(sh.Command("./download.sh"))
32+
build_dir = self.get_build_dir(arch.arch)
33+
34+
with open(os.path.join(build_dir, ".gitmodules"), "r") as file:
35+
for section in file.read().split('[submodule "')[1:]:
36+
line_split = section.split(" = ")
37+
# Parse .gitmodule section
38+
clone_path, url, branch = (
39+
os.path.join(build_dir, line_split[1].split("\n")[0].strip()),
40+
line_split[2].split("\n")[0].strip(),
41+
line_split[-1].strip()
42+
)
43+
# Clone if needed
44+
if not os.path.exists(clone_path) or not os.listdir(clone_path):
45+
shprint(
46+
sh.git, "clone", url,
47+
"--depth", "1", "-b",
48+
branch, clone_path, "--recursive"
49+
)
50+
3851
super().prebuild_arch(arch)
3952

4053

0 commit comments

Comments
 (0)