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 = None , arch = None ):
1111 with current_directory (join (recipe .get_build_dir (arch .arch ), "kivy" )):
1212 kivy_version = shprint (
1313 sh .Command (sys .executable ),
1414 "-c" ,
1515 "import _version; print(_version.__version__)" ,
1616 )
17+ return str (kivy_version )
18+
19+
20+ def is_kivy_affected_by_deadlock_issue (recipe = None , arch = None ):
21+ return packaging .version .parse (
22+ get_kivy_version (recipe , arch )
23+ ) < packaging .version .Version ("2.2.0.dev0" )
24+
1725
18- return packaging .version .parse (
19- str (kivy_version )
20- ) < packaging .version .Version ("2.2.0.dev0" )
26+ def is_kivy_less_than_3 (recipe = None , arch = None ):
27+ return packaging .version .parse (
28+ get_kivy_version (recipe , arch )
29+ ) < packaging .version .Version ("3.0.0.dev0" )
2130
2231
2332class KivyRecipe (PyProjectRecipe ):
24- version = ' 2.3.1'
25- url = ' https://github.com/kivy/kivy/archive/{version}.zip'
26- name = ' kivy'
33+ version = " 2.3.1"
34+ url = " https://github.com/kivy/kivy/archive/{version}.zip"
35+ name = " kivy"
2736
28- depends = [(' sdl2' , ' sdl3' ), ' pyjnius' , ' setuptools' , ' android' ]
29- python_depends = [' certifi' , ' chardet' , ' idna' , ' requests' , ' urllib3' , ' filetype' ]
37+ depends = [(" sdl2" , " sdl3" ), " pyjnius" , " setuptools" , " android" ]
38+ python_depends = [" certifi" , " chardet" , " idna" , " requests" , " urllib3" , " filetype" ]
3039 hostpython_prerequisites = ["cython>=0.29.1,<=3.0.12" ]
3140
3241 # sdl-gl-swapwindow-nogil.patch is needed to avoid a deadlock.
3342 # See: https://github.com/kivy/kivy/pull/8025
3443 # WARNING: Remove this patch when a new Kivy version is released.
3544 patches = [
3645 ("sdl-gl-swapwindow-nogil.patch" , is_kivy_affected_by_deadlock_issue ),
37- "use_cython.patch" ,
38- "no-ast-str.patch"
46+ ( "use_cython.patch" , is_kivy_less_than_3 ) ,
47+ "no-ast-str.patch" ,
3948 ]
4049
4150 @property
@@ -49,27 +58,32 @@ def get_recipe_env(self, arch, **kwargs):
4958 env = super ().get_recipe_env (arch , ** kwargs )
5059
5160 # Taken from CythonRecipe
52- env ['LDFLAGS' ] = env ['LDFLAGS' ] + ' -L{} ' .format (
53- self .ctx .get_libs_dir (arch .arch ) +
54- ' -L{} ' .format (self .ctx .libs_dir ) +
55- ' -L{}' .format (join (self .ctx .bootstrap .build_dir , 'obj' , 'local' ,
56- arch .arch )))
57- env ['LDSHARED' ] = env ['CC' ] + ' -shared'
58- env ['LIBLINK' ] = 'NOTNONE'
61+ env ["LDFLAGS" ] = env ["LDFLAGS" ] + " -L{} " .format (
62+ self .ctx .get_libs_dir (arch .arch )
63+ + " -L{} " .format (self .ctx .libs_dir )
64+ + " -L{}" .format (
65+ join (self .ctx .bootstrap .build_dir , "obj" , "local" , arch .arch )
66+ )
67+ )
68+ env ["LDSHARED" ] = env ["CC" ] + " -shared"
69+ env ["LIBLINK" ] = "NOTNONE"
70+ env ["KIVY_CROSS_PLATFORM" ] = "android"
5971
6072 # NDKPLATFORM is our switch for detecting Android platform, so can't be None
61- env ['NDKPLATFORM' ] = "NOTNONE"
62- if 'sdl2' in self .ctx .recipe_build_order :
63- env ['USE_SDL2' ] = '1'
64- env ['KIVY_SPLIT_EXAMPLES' ] = '1'
65- sdl2_mixer_recipe = self .get_recipe ('sdl2_mixer' , self .ctx )
66- sdl2_image_recipe = self .get_recipe ('sdl2_image' , self .ctx )
67- env ['KIVY_SDL2_PATH' ] = ':' .join ([
68- join (self .ctx .bootstrap .build_dir , 'jni' , 'SDL' , 'include' ),
69- * sdl2_image_recipe .get_include_dirs (arch ),
70- * sdl2_mixer_recipe .get_include_dirs (arch ),
71- join (self .ctx .bootstrap .build_dir , 'jni' , 'SDL2_ttf' ),
72- ])
73+ env ["NDKPLATFORM" ] = "NOTNONE"
74+ if "sdl2" in self .ctx .recipe_build_order :
75+ env ["USE_SDL2" ] = "1"
76+ env ["KIVY_SPLIT_EXAMPLES" ] = "1"
77+ sdl2_mixer_recipe = self .get_recipe ("sdl2_mixer" , self .ctx )
78+ sdl2_image_recipe = self .get_recipe ("sdl2_image" , self .ctx )
79+ env ["KIVY_SDL2_PATH" ] = ":" .join (
80+ [
81+ join (self .ctx .bootstrap .build_dir , "jni" , "SDL" , "include" ),
82+ * sdl2_image_recipe .get_include_dirs (arch ),
83+ * sdl2_mixer_recipe .get_include_dirs (arch ),
84+ join (self .ctx .bootstrap .build_dir , "jni" , "SDL2_ttf" ),
85+ ]
86+ )
7387 if "sdl3" in self .ctx .recipe_build_order :
7488 sdl3_mixer_recipe = self .get_recipe ("sdl3_mixer" , self .ctx )
7589 sdl3_image_recipe = self .get_recipe ("sdl3_image" , self .ctx )
0 commit comments