Skip to content

Commit 78f76cb

Browse files
committed
Use pip install instead of setup.py install in recipe.py
On Python 3.14, many recipes, notably `msgpack`, no longer byte- compile with `setup.py install`, because the way that command byte-compiles relies on `distutils`, which is gone.
1 parent 9720dbd commit 78f76cb

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

pythonforandroid/recipe.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,18 +1020,11 @@ def install_python_package(self, arch, name=None, env=None, is_dir=True):
10201020
hostpython = sh.Command(self.hostpython_location)
10211021
hpenv = env.copy()
10221022
with current_directory(self.get_build_dir(arch.arch)):
1023-
1024-
if isfile("setup.py"):
1025-
shprint(hostpython, 'setup.py', 'install', '-O2',
1026-
'--root={}'.format(self.ctx.get_python_install_dir(arch.arch)),
1027-
'--install-lib=.',
1028-
_env=hpenv, *self.setup_extra_args)
1029-
1030-
# If asked, also install in the hostpython build dir
1031-
if self.install_in_hostpython:
1032-
self.install_hostpython_package(arch)
1033-
else:
1034-
warning("`PythonRecipe.install_python_package` called without `setup.py` file!")
1023+
shprint(hostpython, '-m', 'pip', 'install', '.',
1024+
'--compile',
1025+
f'--root={self.ctx.get_python_install_dir(arch.arch)}',
1026+
_env=hpenv, *self.setup_extra_args
1027+
)
10351028

10361029
def get_hostrecipe_env(self, arch=None):
10371030
env = environ.copy()
@@ -1048,7 +1041,8 @@ def hostpython_site_dir(self):
10481041
def install_hostpython_package(self, arch):
10491042
env = self.get_hostrecipe_env(arch)
10501043
real_hostpython = sh.Command(self.real_hostpython_location)
1051-
shprint(real_hostpython, 'setup.py', 'install', '-O2',
1044+
shprint(real_hostpython, '-m', 'pip', 'install', '.',
1045+
'--compile',
10521046
'--install-lib=Lib/site-packages',
10531047
'--root={}'.format(self._host_recipe.site_root),
10541048
_env=env, *self.setup_extra_args)
@@ -1095,7 +1089,7 @@ class CompiledComponentsPythonRecipe(PythonRecipe):
10951089

10961090
def build_arch(self, arch):
10971091
'''Build any cython components, then install the Python module by
1098-
calling setup.py install with the target Python dir.
1092+
calling pip install with the target Python dir.
10991093
'''
11001094
Recipe.build_arch(self, arch)
11011095
self.install_hostpython_prerequisites()
@@ -1144,7 +1138,7 @@ class CythonRecipe(PythonRecipe):
11441138

11451139
def build_arch(self, arch):
11461140
'''Build any cython components, then install the Python module by
1147-
calling setup.py install with the target Python dir.
1141+
calling pip install with the target Python dir.
11481142
'''
11491143
Recipe.build_arch(self, arch)
11501144
self.build_cython_components(arch)

0 commit comments

Comments
 (0)