1- import glob
2- from os .path import basename , exists , join
1+ from os .path import join
32import sys
43import packaging .version
54
65import sh
7- from pythonforandroid .recipe import CythonRecipe
6+ from pythonforandroid .recipe import CythonRecipe , PyProjectRecipe
87from pythonforandroid .toolchain import current_directory , shprint
98
109
@@ -21,7 +20,7 @@ def is_kivy_affected_by_deadlock_issue(recipe=None, arch=None):
2120 ) < packaging .version .Version ("2.2.0.dev0" )
2221
2322
24- class KivyRecipe (CythonRecipe ):
23+ class KivyRecipe (PyProjectRecipe ):
2524 version = '2.3.1'
2625 url = 'https://github.com/kivy/kivy/archive/{version}.zip'
2726 name = 'kivy'
@@ -33,34 +32,11 @@ class KivyRecipe(CythonRecipe):
3332 # sdl-gl-swapwindow-nogil.patch is needed to avoid a deadlock.
3433 # See: https://github.com/kivy/kivy/pull/8025
3534 # WARNING: Remove this patch when a new Kivy version is released.
36- patches = [("sdl-gl-swapwindow-nogil.patch" , is_kivy_affected_by_deadlock_issue )]
35+ patches = [("sdl-gl-swapwindow-nogil.patch" , is_kivy_affected_by_deadlock_issue ), "use_cython.patch" ]
3736
38- def cythonize_build (self , env , build_dir = '.' ):
39- super ().cythonize_build (env , build_dir = build_dir )
40-
41- if not exists (join (build_dir , 'kivy' , 'include' )):
42- return
43-
44- # If kivy is new enough to use the include dir, copy it
45- # manually to the right location as we bypass this stage of
46- # the build
47- with current_directory (build_dir ):
48- build_libs_dirs = glob .glob (join ('build' , 'lib.*' ))
49-
50- for dirn in build_libs_dirs :
51- shprint (sh .cp , '-r' , join ('kivy' , 'include' ),
52- join (dirn , 'kivy' ))
53-
54- def cythonize_file (self , env , build_dir , filename ):
55- # We can ignore a few files that aren't important to the
56- # android build, and may not work on Android anyway
57- do_not_cythonize = ['window_x11.pyx' , 'camera_avfoundation.pyx' , 'img_imageio.pyx' , 'egl_angle_metal.pyx' ]
58- if basename (filename ) in do_not_cythonize :
59- return
60- super ().cythonize_file (env , build_dir , filename )
61-
62- def get_recipe_env (self , arch ):
63- env = super ().get_recipe_env (arch )
37+ def get_recipe_env (self , arch , ** kwargs ):
38+ env = super ().get_recipe_env (arch , ** kwargs )
39+ env .update (CythonRecipe .get_recipe_env (self , arch ))
6440 # NDKPLATFORM is our switch for detecting Android platform, so can't be None
6541 env ['NDKPLATFORM' ] = "NOTNONE"
6642 if 'sdl2' in self .ctx .recipe_build_order :
0 commit comments