diff --git a/pythonforandroid/build.py b/pythonforandroid/build.py index a5845358bf..c4c5327e6e 100644 --- a/pythonforandroid/build.py +++ b/pythonforandroid/build.py @@ -27,14 +27,6 @@ RECOMMENDED_NDK_API, RECOMMENDED_TARGET_API) -def get_cython_path(): - for cython_fn in ("cython", "cython3", "cython2", "cython-2.7"): - cython = sh.which(cython_fn) - if cython: - return cython - raise BuildInterruptingException('No cython binary found.') - - def get_ndk_platform_dir(ndk_dir, ndk_api, arch): ndk_platform_dir_exists = True platform_dir = arch.platform_dir @@ -111,7 +103,6 @@ class Context(object): use_setup_py = False ccache = None # whether to use ccache - cython = None # the cython interpreter name ndk_platform = None # the ndk platform directory @@ -374,7 +365,6 @@ def prepare_build_environment(self, if not self.ccache: info('ccache is missing, the build will not be optimized in the ' 'future.') - self.cython = get_cython_path() # This would need to be changed if supporting multiarch APKs arch = self.archs[0] diff --git a/pythonforandroid/recipe.py b/pythonforandroid/recipe.py index 4de888306a..207680c236 100644 --- a/pythonforandroid/recipe.py +++ b/pythonforandroid/recipe.py @@ -1024,8 +1024,12 @@ def cythonize_file(self, env, build_dir, filename): del cyenv['PYTHONPATH'] if 'PYTHONNOUSERSITE' in cyenv: cyenv.pop('PYTHONNOUSERSITE') - cython_command = sh.Command(self.ctx.cython) - shprint(cython_command, filename, *self.cython_args, _env=cyenv) + cython_command = sh.Command( + "python" + + self.ctx.python_recipe.major_minor_version_string.split(".")[0] + ) + shprint(cython_command, "-m", "Cython", + filename, *self.cython_args, _env=cyenv) def cythonize_build(self, env, build_dir="."): if not self.cythonize: diff --git a/tests/test_toolchain.py b/tests/test_toolchain.py index a4b68c86ee..11e35ff989 100644 --- a/tests/test_toolchain.py +++ b/tests/test_toolchain.py @@ -68,8 +68,6 @@ def test_create(self): ) as m_get_toolchain_versions, mock.patch( 'pythonforandroid.build.get_ndk_platform_dir' ) as m_get_ndk_platform_dir, mock.patch( - 'pythonforandroid.build.get_cython_path' - ) as m_get_cython_path, mock.patch( 'pythonforandroid.toolchain.build_recipes' ) as m_build_recipes, mock.patch( 'pythonforandroid.bootstraps.service_only.' @@ -84,7 +82,6 @@ def test_create(self): mock.call('/tmp/android-sdk')] assert m_get_toolchain_versions.call_args_list == [ mock.call('/tmp/android-ndk', mock.ANY)] - assert m_get_cython_path.call_args_list == [mock.call()] build_order = [ 'hostpython3', 'libffi', 'openssl', 'sqlite3', 'python3', 'genericndkbuild', 'setuptools', 'six', 'pyjnius', 'android',