Repository navigation
Closed
Closed
Copy link
Description
A PyProjectRecipe with install_in_hostpython = True builds but does not install the package in hostpython. It does install the package for target Python.
Presumably because both of these fragments in recipy.py assume only setup.py, and the pyproject.toml case is not implemented:
def install_hostpython_package(self, arch):
env = self.get_hostrecipe_env(arch)
real_hostpython = sh.Command(self.real_hostpython_location)
shprint(real_hostpython, 'setup.py', 'install', '-O2',
'--root={}'.format(dirname(self.real_hostpython_location)),
'--install-lib=Lib/site-packages',
_env=env, *self.setup_extra_args) def build_compiled_components(self, arch):
info('Building compiled components in {}'.format(self.name))
env = self.get_recipe_env(arch)
hostpython = sh.Command(self.hostpython_location)
with current_directory(self.get_build_dir(arch.arch)):
if self.install_in_hostpython:
shprint(hostpython, 'setup.py', 'clean', '--all', _env=env)
shprint(hostpython, 'setup.py', self.build_cmd, '-v',
_env=env, *self.setup_extra_args)
build_dir = glob.glob('build/lib.*')[0]
shprint(sh.find, build_dir, '-name', '"*.o"', '-exec',
env['STRIP'], '{}', ';', _env=env)The good news is none of the existing recipes with install_in_hostpython = True use PyProjectRecipe.
The issue was discovered while updating the (to be reinstated) cppy recipe.
from pythonforandroid.recipe import PyProjectRecipe
class CppyRecipe(PyProjectRecipe):
site_packages_name = 'cppy'
version = '1.3.1'
url = 'https://github.com/nucleic/cppy/archive/refs/tags/{version}.zip'
call_hostpython_via_targetpython = False
# to be detected by the matplotlib install script
install_in_hostpython = True
depends = ['setuptools']
def get_recipe_env(self, arch, **kwargs):
env = super().get_recipe_env(arch, **kwargs)
env["SETUPTOOLS_SCM_PRETEND_VERSION_FOR_CPPY"] = self.version
return env
recipe = CppyRecipe()
The simplest test is :
requirements = python3,kivy,cppy
buildozer android debug
This ls shows cppy installed for android:
ls .buildozer/android/platform/build-arm64-v8a/dists/myapp/_python_bundle__arm64-v8a/_python_bundle/site-packages
but these ls show cppy is not installed for either hostpython:
ls .buildozer/android/platform/build-arm64-v8a/build/other_builds/hostpython3/desktop/hostpython3/native-build/Lib/site-packages
ls .buildozer/android/platform/build-arm64-v8a/build/other_builds/hostpython3/desktop/hostpython3/Lib/site-packages
Build log attached
Metadata
Metadata
Assignees
Labels
No labels
Activity
T-Dynamos commentedon Mar 10, 2025
install_in_hostpythonisn't required forPyProjectRecipeyou can specify inhostpython_prerequisites.python-for-android/pythonforandroid/recipe.py
Line 870 in ceed049
RobertFlatt commentedon Mar 11, 2025
😎
Works smoothly.
Both the dependency
.hand.pyare found during the build ofatom.I also tried replacing
dependswithhostpython_prerequisitesonkiwisolverand it worked too (but manual Python.h is still required).