@@ -741,6 +741,9 @@ def real_hostpython_location(self):
741
741
return join (
742
742
Recipe .get_recipe ('hostpython3crystax' , self .ctx ).get_build_dir (),
743
743
'hostpython' )
744
+ elif 'hostpython3' in self .ctx .recipe_build_order :
745
+ return join (Recipe .get_recipe ('hostpython3' , self .ctx ).get_build_dir (),
746
+ 'native-build' , 'python' )
744
747
else :
745
748
python_recipe = self .ctx .python_recipe
746
749
return 'python{}' .format (python_recipe .version )
@@ -784,15 +787,15 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True):
784
787
join (ndk_dir_python , 'libs' , arch .arch ))
785
788
env ['LDFLAGS' ] += ' -lpython{}m' .format (python_short_version )
786
789
elif 'python3' in self .ctx .recipe_build_order :
787
- # This headers are unused cause python3 recipe was removed
788
- # TODO: should be reviewed when python3 recipe added
789
- env ['PYTHON_ROOT' ] = self .ctx . get_python_install_dir ( )
790
- env ['CFLAGS' ] += ' -I' + env [
791
- 'PYTHON_ROOT ' ] + '/include/python{}m' . format (
792
- python_short_version )
793
- env [ 'LDFLAGS' ] += ' -L' + env ['PYTHON_ROOT' ] + '/lib' + \
794
- ' -lpython{}m' . format (
795
- python_short_version )
790
+ # TODO: Make the recipe env get these details from the
791
+ # python recipe instead of hardcoding
792
+ env ['PYTHON_ROOT' ] = Recipe . get_recipe ( 'python3' , self .ctx ). get_build_dir ( arch . arch )
793
+ env ['CFLAGS' ] += ' -I' + env ['PYTHON_ROOT' ] + '/Include'
794
+ env [ 'LDFLAGS ' ] += (
795
+ ' -L' +
796
+ join ( env ['PYTHON_ROOT' ], 'android-build' ) +
797
+ ' -lpython3.7m' )
798
+
796
799
hppath = []
797
800
hppath .append (join (dirname (self .hostpython_location ), 'Lib' ))
798
801
hppath .append (join (hppath [0 ], 'site-packages' ))
@@ -833,7 +836,8 @@ def install_python_package(self, arch, name=None, env=None, is_dir=True):
833
836
with current_directory (self .get_build_dir (arch .arch )):
834
837
hostpython = sh .Command (self .hostpython_location )
835
838
836
- if self .ctx .python_recipe .from_crystax :
839
+ if (self .ctx .python_recipe .from_crystax or
840
+ self .ctx .python_recipe .name == 'python3' ):
837
841
hpenv = env .copy ()
838
842
shprint (hostpython , 'setup.py' , 'install' , '-O2' ,
839
843
'--root={}' .format (self .ctx .get_python_install_dir ()),
@@ -1013,7 +1017,7 @@ def build_cython_components(self, arch):
1013
1017
shprint (sh .find , build_lib [0 ], '-name' , '*.o' , '-exec' ,
1014
1018
env ['STRIP' ], '{}' , ';' , _env = env )
1015
1019
1016
- if ' python3crystax' in self . ctx . recipe_build_order :
1020
+ else : # python3crystax or python3
1017
1021
info ('Stripping object files' )
1018
1022
shprint (sh .find , '.' , '-iname' , '*.so' , '-exec' ,
1019
1023
'/usr/bin/echo' , '{}' , ';' , _env = env )
@@ -1057,8 +1061,8 @@ def get_recipe_env(self, arch, with_flags_in_cc=True):
1057
1061
if self .ctx .python_recipe .from_crystax :
1058
1062
env ['LDFLAGS' ] = (env ['LDFLAGS' ] +
1059
1063
' -L{}' .format (join (self .ctx .bootstrap .build_dir , 'libs' , arch .arch )))
1060
- # ' -L/home/asandy/.local/share/python-for-android/build/bootstrap_builds/sdl2/libs/armeabi '
1061
- if self .ctx .python_recipe .from_crystax :
1064
+
1065
+ if self .ctx .python_recipe .from_crystax or self . ctx . python_recipe . name == 'python3' :
1062
1066
env ['LDSHARED' ] = env ['CC' ] + ' -shared'
1063
1067
else :
1064
1068
env ['LDSHARED' ] = join (self .ctx .root_dir , 'tools' , 'liblink.sh' )
0 commit comments