77from pythonforandroid .toolchain import current_directory , shprint
88
99
10- def is_kivy_affected_by_deadlock_issue (recipe = None , arch = None ):
10+ def get_kivy_version (recipe , arch ):
1111 with current_directory (join (recipe .get_build_dir (arch .arch ), "kivy" )):
12- kivy_version = shprint (
12+ return shprint (
1313 sh .Command (sys .executable ),
1414 "-c" ,
1515 "import _version; print(_version.__version__)" ,
1616 )
1717
18- return packaging .version .parse (
19- str (kivy_version )
20- ) < packaging .version .Version ("2.2.0.dev0" )
18+
19+ def is_kivy_affected_by_deadlock_issue (recipe = None , arch = None ):
20+ return packaging .version .parse (
21+ str (get_kivy_version (recipe , arch ))
22+ ) < packaging .version .Version ("2.2.0.dev0" )
23+
24+
25+ def is_kivy_less_than_3 (recipe = None , arch = None ):
26+ return packaging .version .parse (
27+ str (get_kivy_version (recipe , arch ))
28+ ) < packaging .version .Version ("3.0.0" )
2129
2230
2331class KivyRecipe (PyProjectRecipe ):
@@ -34,7 +42,7 @@ class KivyRecipe(PyProjectRecipe):
3442 # WARNING: Remove this patch when a new Kivy version is released.
3543 patches = [
3644 ("sdl-gl-swapwindow-nogil.patch" , is_kivy_affected_by_deadlock_issue ),
37- "use_cython.patch" ,
45+ ( "use_cython.patch" , is_kivy_less_than_3 ) ,
3846 "no-ast-str.patch"
3947 ]
4048
@@ -59,6 +67,9 @@ def get_recipe_env(self, arch, **kwargs):
5967
6068 # NDKPLATFORM is our switch for detecting Android platform, so can't be None
6169 env ['NDKPLATFORM' ] = "NOTNONE"
70+ if not is_kivy_less_than_3 (self , arch ):
71+ env ['KIVY_CROSS_PLATFORM' ] = 'android'
72+
6273 if 'sdl2' in self .ctx .recipe_build_order :
6374 env ['USE_SDL2' ] = '1'
6475 env ['KIVY_SPLIT_EXAMPLES' ] = '1'
0 commit comments