Skip to content

Commit f150014

Browse files
committed
Added path to hostpython in python3 build env
1 parent 12346d2 commit f150014

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pythonforandroid/recipes/hostpython3/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from os.path import join, exists
44
import sh
55

6+
BUILD_SUBDIR = 'native-build'
7+
68

79
class Hostpython3Recipe(Recipe):
810
version = '3.7.1'
@@ -20,11 +22,14 @@ def get_build_dir(self, arch=None):
2022
# Unlike other recipes, the hostpython build dir doesn't depend on the target arch
2123
return join(self.get_build_container_dir(), self.name)
2224

25+
def get_path_to_python(self):
26+
return join(self.get_build_dir(), BUILD_SUBDIR)
27+
2328
def build_arch(self, arch):
2429
recipe_build_dir = self.get_build_dir(arch.arch)
2530

2631
# Create a subdirectory to actually perform the build
27-
build_dir = join(recipe_build_dir, 'native-build')
32+
build_dir = join(recipe_build_dir, BUILD_SUBDIR)
2833
ensure_dir(build_dir)
2934

3035
if not exists(join(build_dir, 'python')):

pythonforandroid/recipes/python3/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ def build_arch(self, arch):
8383
env['READELF'] = READELF
8484
env['STRIP'] = STRIP
8585

86+
env['PATH'] = '{hostpython_dir}:{old_path}'.format(
87+
hostpython_dir=self.get_recipe('hostpython3', self.ctx).get_path_to_python(),
88+
old_path=env['PATH'])
89+
8690
ndk_flags = ('--sysroot={ndk_sysroot} -D__ANDROID_API__={android_api} '
8791
'-isystem {ndk_android_host}').format(
8892
ndk_sysroot=join(self.ctx.ndk_dir, 'sysroot'),

0 commit comments

Comments
 (0)