@@ -742,6 +742,9 @@ def real_hostpython_location(self):
742742 return join (
743743 Recipe .get_recipe ('hostpython3crystax' , self .ctx ).get_build_dir (),
744744 'hostpython' )
745+ elif 'hostpython3' in self .ctx .recipe_build_order :
746+ return join (Recipe .get_recipe ('hostpython3' , self .ctx ).get_build_dir (),
747+ 'native-build' , 'python' )
745748 else :
746749 python_recipe = self .ctx .python_recipe
747750 return 'python{}' .format (python_recipe .version )
@@ -785,15 +788,15 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True):
785788 join (ndk_dir_python , 'libs' , arch .arch ))
786789 env ['LDFLAGS' ] += ' -lpython{}m' .format (python_short_version )
787790 elif 'python3' in self .ctx .recipe_build_order :
788- # This headers are unused cause python3 recipe was removed
789- # TODO: should be reviewed when python3 recipe added
790- env ['PYTHON_ROOT' ] = self .ctx .get_python_install_dir ()
791- env ['CFLAGS' ] += ' -I' + env [
792- 'PYTHON_ROOT' ] + '/include/python{}m' .format (
793- python_short_version )
791+ # TODO: Make the recipe env get these details from the
792+ # python recipe instead of hardcoding
793+ env ['PYTHON_ROOT' ] = Recipe .get_recipe ('python3' , self .ctx ).get_build_dir (arch .arch )
794+ env ['CFLAGS' ] += ' -I' + env ['PYTHON_ROOT' ] + '/Include'
794795 env ['LDFLAGS' ] += (
795- ' -L' + env ['PYTHON_ROOT' ] + '/lib' +
796- ' -lpython{}m' .format (python_short_version ))
796+ ' -L' +
797+ join (env ['PYTHON_ROOT' ], 'android-build' ) +
798+ ' -lpython3.7m' )
799+
797800 hppath = []
798801 hppath .append (join (dirname (self .hostpython_location ), 'Lib' ))
799802 hppath .append (join (hppath [0 ], 'site-packages' ))
@@ -834,7 +837,8 @@ def install_python_package(self, arch, name=None, env=None, is_dir=True):
834837 with current_directory (self .get_build_dir (arch .arch )):
835838 hostpython = sh .Command (self .hostpython_location )
836839
837- if self .ctx .python_recipe .from_crystax :
840+ if (self .ctx .python_recipe .from_crystax or
841+ self .ctx .python_recipe .name == 'python3' ):
838842 hpenv = env .copy ()
839843 shprint (hostpython , 'setup.py' , 'install' , '-O2' ,
840844 '--root={}' .format (self .ctx .get_python_install_dir ()),
@@ -1016,7 +1020,7 @@ def build_cython_components(self, arch):
10161020 shprint (sh .find , build_lib [0 ], '-name' , '*.o' , '-exec' ,
10171021 env ['STRIP' ], '{}' , ';' , _env = env )
10181022
1019- if ' python3crystax' in self . ctx . recipe_build_order :
1023+ else : # python3crystax or python3
10201024 info ('Stripping object files' )
10211025 shprint (sh .find , '.' , '-iname' , '*.so' , '-exec' ,
10221026 '/usr/bin/echo' , '{}' , ';' , _env = env )
@@ -1060,8 +1064,8 @@ def get_recipe_env(self, arch, with_flags_in_cc=True):
10601064 if self .ctx .python_recipe .from_crystax :
10611065 env ['LDFLAGS' ] = (env ['LDFLAGS' ] +
10621066 ' -L{}' .format (join (self .ctx .bootstrap .build_dir , 'libs' , arch .arch )))
1063- # ' -L/home/asandy/.local/share/python-for-android/build/bootstrap_builds/sdl2/libs/armeabi '
1064- if self .ctx .python_recipe .from_crystax :
1067+
1068+ if self .ctx .python_recipe .from_crystax or self . ctx . python_recipe . name == 'python3' :
10651069 env ['LDSHARED' ] = env ['CC' ] + ' -shared'
10661070 else :
10671071 env ['LDSHARED' ] = join (self .ctx .root_dir , 'tools' , 'liblink.sh' )
0 commit comments