2
2
import sh
3
3
from pythonforandroid .logger import shprint
4
4
from pythonforandroid .recipe import BootstrapNDKRecipe
5
- from pythonforandroid .util import current_directory
6
5
7
6
8
7
class LibSDL2Image (BootstrapNDKRecipe ):
9
- version = '2.8.0 '
8
+ version = '2.8.2 '
10
9
url = 'https://github.com/libsdl-org/SDL_image/releases/download/release-{version}/SDL2_image-{version}.tar.gz'
11
10
dir_name = 'SDL2_image'
12
11
@@ -20,10 +19,26 @@ def get_include_dirs(self, arch):
20
19
def prebuild_arch (self , arch ):
21
20
# We do not have a folder for each arch on BootstrapNDKRecipe, so we
22
21
# 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
+
27
42
super ().prebuild_arch (arch )
28
43
29
44
0 commit comments