From 2284ecb4129775a9d2163d1e1a1d271c1992f29e Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Mon, 28 May 2018 15:24:06 +0100 Subject: [PATCH] Made hostpython3crystax check if system python is available --- pythonforandroid/recipes/hostpython3crystax/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pythonforandroid/recipes/hostpython3crystax/__init__.py b/pythonforandroid/recipes/hostpython3crystax/__init__.py index 8c37aec2ed..12dc172753 100644 --- a/pythonforandroid/recipes/hostpython3crystax/__init__.py +++ b/pythonforandroid/recipes/hostpython3crystax/__init__.py @@ -4,9 +4,7 @@ class Hostpython3Recipe(Recipe): - version = '3.5' - # url = 'http://python.org/ftp/python/{version}/Python-{version}.tgz' - # url = 'https://github.com/crystax/android-vendor-python-3-5/archive/master.zip' + version = 'auto' # the version is taken from the python3crystax recipe name = 'hostpython3crystax' conflicts = ['hostpython2'] @@ -36,6 +34,10 @@ def build_arch(self, arch): shprint(sh.mkdir, '-p', sub_build_dir) python3crystax = self.get_recipe('python3crystax', self.ctx) system_python = sh.which("python" + python3crystax.version) + if system_python is None: + raise OSError( + ('Trying to use python3crystax=={} but this Python version ' + 'is not installed locally.').format(python3crystax.version)) link_dest = join(self.get_build_dir(), 'hostpython') shprint(sh.ln, '-sf', system_python, link_dest)