Skip to content

Commit ed36e8d

Browse files
author
Pol Canelles
committed
Fix moved to CompiledComponentsPythonRecipe
1 parent fe3fc3d commit ed36e8d

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

pythonforandroid/recipe.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -762,11 +762,6 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True):
762762
env['PYTHONPATH'] = ':'.join(hppath + [env['PYTHONPATH']])
763763
else:
764764
env['PYTHONPATH'] = ':'.join(hppath)
765-
if 'python2' in self.ctx.recipe_build_order:
766-
env['PYTHON_ROOT'] = self.ctx.get_python_install_dir()
767-
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7'
768-
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + \
769-
' -lpython2.7'
770765
return env
771766

772767
def should_build(self, arch):
@@ -864,6 +859,17 @@ class CompiledComponentsPythonRecipe(PythonRecipe):
864859

865860
build_cmd = 'build_ext'
866861

862+
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
863+
env = super(CompiledComponentsPythonRecipe,
864+
self).get_recipe_env(arch, with_flags_in_cc)
865+
if not self.call_hostpython_via_targetpython:
866+
if 'python2' in self.ctx.recipe_build_order:
867+
env['PYTHON_ROOT'] = self.ctx.get_python_install_dir()
868+
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7'
869+
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + \
870+
' -lpython2.7'
871+
return env
872+
867873
def build_arch(self, arch):
868874
'''Build any cython components, then install the Python module by
869875
calling setup.py install with the target Python dir.

0 commit comments

Comments
 (0)