Skip to content

symlink system Python to hostpython3crystax build dir #1249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pythonforandroid/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,10 @@ def real_hostpython_location(self):
return join(
Recipe.get_recipe('hostpython2', self.ctx).get_build_dir(),
'hostpython')
elif 'hostpython3crystax' in self.ctx.recipe_build_order:
return join(
Recipe.get_recipe('hostpython3crystax', self.ctx).get_build_dir(),
'hostpython')
else:
python_recipe = self.ctx.python_recipe
return 'python{}'.format(python_recipe.version)
Expand Down
24 changes: 20 additions & 4 deletions pythonforandroid/recipes/hostpython3crystax/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

from pythonforandroid.toolchain import Recipe, shprint, current_directory, info, warning
from os.path import join, exists
from os import chdir
from pythonforandroid.toolchain import Recipe, shprint
from os.path import join
import sh


Expand All @@ -13,14 +11,32 @@ class Hostpython3Recipe(Recipe):

conflicts = ['hostpython2']

def get_build_container_dir(self, arch=None):
choices = self.check_recipe_choices()
dir_name = '-'.join([self.name] + choices)
return join(self.ctx.build_dir, 'other_builds', dir_name, 'desktop')

# def prebuild_armeabi(self):
# # Override hostpython Setup?
# shprint(sh.cp, join(self.get_recipe_dir(), 'Setup'),
# join(self.get_build_dir('armeabi'), 'Modules', 'Setup'))

def get_build_dir(self, arch=None):
return join(self.get_build_container_dir(), self.name)

def build_arch(self, arch):
"""
Creates expected build and symlinks system Python version.
"""
self.ctx.hostpython = '/usr/bin/false'
self.ctx.hostpgen = '/usr/bin/false'
# creates the sub buildir (used by other recipes)
# https://github.com/kivy/python-for-android/issues/1154
sub_build_dir = join(self.get_build_dir(), 'build')
shprint(sh.mkdir, '-p', sub_build_dir)
system_python = sh.which("python" + self.version)
link_dest = join(self.get_build_dir(), 'hostpython')
shprint(sh.ln, '-sf', system_python, link_dest)


recipe = Hostpython3Recipe()