1-
2- from pythonforandroid .toolchain import Recipe , shprint , current_directory , info , warning
3- from os .path import join , exists
4- from os import chdir
1+ from pythonforandroid .toolchain import Recipe , shprint
2+ from os .path import join
53import sh
64
75
@@ -13,14 +11,32 @@ class Hostpython3Recipe(Recipe):
1311
1412 conflicts = ['hostpython2' ]
1513
14+ def get_build_container_dir (self , arch = None ):
15+ choices = self .check_recipe_choices ()
16+ dir_name = '-' .join ([self .name ] + choices )
17+ return join (self .ctx .build_dir , 'other_builds' , dir_name , 'desktop' )
18+
1619 # def prebuild_armeabi(self):
1720 # # Override hostpython Setup?
1821 # shprint(sh.cp, join(self.get_recipe_dir(), 'Setup'),
1922 # join(self.get_build_dir('armeabi'), 'Modules', 'Setup'))
2023
24+ def get_build_dir (self , arch = None ):
25+ return join (self .get_build_container_dir (), self .name )
26+
2127 def build_arch (self , arch ):
28+ """
29+ Creates expected build and symlinks system Python version.
30+ """
2231 self .ctx .hostpython = '/usr/bin/false'
2332 self .ctx .hostpgen = '/usr/bin/false'
33+ # creates the sub buildir (used by other recipes)
34+ # https://github.com/kivy/python-for-android/issues/1154
35+ sub_build_dir = join (self .get_build_dir (), 'build' )
36+ shprint (sh .mkdir , '-p' , sub_build_dir )
37+ system_python = sh .which ("python" + self .version )
38+ link_dest = join (self .get_build_dir (), 'hostpython' )
39+ shprint (sh .ln , '-sf' , system_python , link_dest )
2440
2541
2642recipe = Hostpython3Recipe ()
0 commit comments