1414 rmdir , move )
1515from pythonforandroid .recipe import Recipe
1616
17+ SDL_BOOTSTRAPS = ("sdl2" , "sdl3" )
18+
1719
1820def copy_files (src_root , dest_root , override = True , symlink = False ):
1921 for root , dirnames , filenames in walk (src_root ):
@@ -39,7 +41,7 @@ def copy_files(src_root, dest_root, override=True, symlink=False):
3941
4042
4143default_recipe_priorities = [
42- "webview" , "sdl2" , "service_only" # last is highest
44+ "webview" , "sdl2" , "sdl3" , " service_only" # last is highest
4345]
4446# ^^ NOTE: these are just the default priorities if no special rules
4547# apply (which you can find in the code below), so basically if no
@@ -150,18 +152,18 @@ def get_bootstrap_dirs(self):
150152 return bootstrap_dirs
151153
152154 def _copy_in_final_files (self ):
153- if self .name == "sdl2" :
154- # Get the paths for copying SDL2 's java source code:
155- sdl2_recipe = Recipe .get_recipe ("sdl2" , self .ctx )
156- sdl2_build_dir = sdl2_recipe .get_jni_dir ()
157- src_dir = join (sdl2_build_dir , "SDL" , "android-project" ,
155+ if self .name in SDL_BOOTSTRAPS :
156+ # Get the paths for copying SDL 's java source code:
157+ sdl_recipe = Recipe .get_recipe (self . name , self .ctx )
158+ sdl_build_dir = sdl_recipe .get_jni_dir ()
159+ src_dir = join (sdl_build_dir , "SDL" , "android-project" ,
158160 "app" , "src" , "main" , "java" ,
159161 "org" , "libsdl" , "app" )
160162 target_dir = join (self .dist_dir , 'src' , 'main' , 'java' , 'org' ,
161163 'libsdl' , 'app' )
162164
163165 # Do actual copying:
164- info ('Copying in SDL2 .java files from: ' + str (src_dir ))
166+ info ('Copying in SDL .java files from: ' + str (src_dir ))
165167 if not os .path .exists (target_dir ):
166168 os .makedirs (target_dir )
167169 copy_files (src_dir , target_dir , override = True )
@@ -193,7 +195,7 @@ def assemble_distribution(self):
193195 @classmethod
194196 def all_bootstraps (cls ):
195197 '''Find all the available bootstraps and return them.'''
196- forbidden_dirs = ('__pycache__' , 'common' )
198+ forbidden_dirs = ('__pycache__' , 'common' , '_sdl_common' )
197199 bootstraps_dir = join (dirname (__file__ ), 'bootstraps' )
198200 result = set ()
199201 for name in listdir (bootstraps_dir ):
@@ -272,6 +274,13 @@ def have_dependency_in_recipes(dep):
272274 info ('Using sdl2 bootstrap since it is in dependencies' )
273275 return cls .get_bootstrap ("sdl2" , ctx )
274276
277+ # Special rule: return SDL3 bootstrap if there's an sdl3 dep:
278+ if (have_dependency_in_recipes ("sdl3" ) and
279+ "sdl3" in [b .name for b in acceptable_bootstraps ]
280+ ):
281+ info ('Using sdl3 bootstrap since it is in dependencies' )
282+ return cls .get_bootstrap ("sdl3" , ctx )
283+
275284 # Special rule: return "webview" if we depend on common web recipe:
276285 for possible_web_dep in known_web_packages :
277286 if have_dependency_in_recipes (possible_web_dep ):
0 commit comments