@@ -20,6 +20,19 @@ def is_kivy_affected_by_deadlock_issue(recipe=None, arch=None):
2020 ) < packaging .version .Version ("2.2.0.dev0" )
2121
2222
23+ def is_kivy_less_than_3 (recipe = None , arch = None ):
24+ with current_directory (join (recipe .get_build_dir (arch .arch ), "kivy" )):
25+ kivy_version = shprint (
26+ sh .Command (sys .executable ),
27+ "-c" ,
28+ "import _version; print(_version.__version__)" ,
29+ )
30+
31+ return packaging .version .parse (
32+ str (kivy_version )
33+ ) < packaging .version .Version ("3.0.0" )
34+
35+
2336class KivyRecipe (PyProjectRecipe ):
2437 version = '2.3.1'
2538 url = 'https://github.com/kivy/kivy/archive/{version}.zip'
@@ -34,7 +47,7 @@ class KivyRecipe(PyProjectRecipe):
3447 # WARNING: Remove this patch when a new Kivy version is released.
3548 patches = [
3649 ("sdl-gl-swapwindow-nogil.patch" , is_kivy_affected_by_deadlock_issue ),
37- "use_cython.patch" ,
50+ ( "use_cython.patch" , is_kivy_less_than_3 ) ,
3851 "no-ast-str.patch"
3952 ]
4053
@@ -59,6 +72,9 @@ def get_recipe_env(self, arch, **kwargs):
5972
6073 # NDKPLATFORM is our switch for detecting Android platform, so can't be None
6174 env ['NDKPLATFORM' ] = "NOTNONE"
75+ if not is_kivy_less_than_3 (self , arch ):
76+ env ['KIVY_CROSS_PLATFORM' ] = 'android'
77+
6278 if 'sdl2' in self .ctx .recipe_build_order :
6379 env ['USE_SDL2' ] = '1'
6480 env ['KIVY_SPLIT_EXAMPLES' ] = '1'
0 commit comments