22import sh
33from pythonforandroid .logger import shprint
44from pythonforandroid .recipe import BootstrapNDKRecipe
5- from pythonforandroid .util import current_directory
65
76
87class 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,26 @@ 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 .gitmodule 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 not os .listdir (clone_path ):
36+ shprint (
37+ sh .git , "clone" , url ,
38+ "--depth" , "1" , "-b" ,
39+ branch , clone_path , "--recursive"
40+ )
41+
2742 super ().prebuild_arch (arch )
2843
2944
0 commit comments