Skip to content

Commit 50dc135

Browse files
committed
Merge branch 'feature/ticket1154_hostpython3crystax_build_dir_and_synlink' into feature/ticket1263_setuptools_python2_and_hostpython3crystax
2 parents f46becf + 066f735 commit 50dc135

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

pythonforandroid/recipe.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,10 @@ def real_hostpython_location(self):
732732
return join(
733733
Recipe.get_recipe('hostpython2', self.ctx).get_build_dir(),
734734
'hostpython')
735+
elif 'hostpython3crystax' in self.ctx.recipe_build_order:
736+
return join(
737+
Recipe.get_recipe('hostpython3crystax', self.ctx).get_build_dir(),
738+
'hostpython')
735739
else:
736740
python_recipe = self.ctx.python_recipe
737741
return 'python{}'.format(python_recipe.version)
Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
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
53
import 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

2642
recipe = Hostpython3Recipe()

0 commit comments

Comments
 (0)