Skip to content

Commit d9ded99

Browse files
committed
sdl2_image: fix downloading
1 parent fbd5255 commit d9ded99

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

pythonforandroid/recipes/sdl2_image/__init__.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
import sh
33
from pythonforandroid.logger import shprint
44
from pythonforandroid.recipe import BootstrapNDKRecipe
5-
from pythonforandroid.util import current_directory
65

76

87
class LibSDL2Image(BootstrapNDKRecipe):
9-
version = '2.8.0'
8+
version = '2.8.2'
109
url = 'https://github.com/libsdl-org/SDL_image/releases/download/release-{version}/SDL2_image-{version}.tar.gz'
1110
dir_name = 'SDL2_image'
1211

@@ -20,10 +19,27 @@ def get_include_dirs(self, arch):
2019
def prebuild_arch(self, arch):
2120
# We do not have a folder for each arch on BootstrapNDKRecipe, so we
2221
# need to skip the external deps download if we already have done it.
23-
external_deps_dir = os.path.join(self.get_build_dir(arch.arch), "external")
24-
if not os.path.exists(os.path.join(external_deps_dir, "libwebp")):
25-
with current_directory(external_deps_dir):
26-
shprint(sh.Command("./download.sh"))
22+
23+
build_dir = self.get_build_dir(arch.arch)
24+
25+
with open(os.path.join(build_dir, ".gitmodules"), "r") as file:
26+
for section in file.read().split('[submodule "')[1:]:
27+
line_split = section.split(" = ")
28+
# Parse .gitmoulde section
29+
clone_path, url, branch = (
30+
os.path.join(build_dir, line_split[1].split("\n")[0].strip()),
31+
line_split[2].split("\n")[0].strip(),
32+
line_split[-1].strip()
33+
)
34+
# Clone if needed
35+
if not os.path.exists(clone_path) or os.listdir(clone_path) == 0:
36+
shprint(
37+
sh.git, "clone", url,
38+
"--depth", "1", "-b",
39+
branch, clone_path, "--recursive"
40+
)
41+
file.close()
42+
2743
super().prebuild_arch(arch)
2844

2945

0 commit comments

Comments
 (0)