Skip to content

Commit c48a766

Browse files
committed
fix pip install path
1 parent b09711f commit c48a766

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

pythonforandroid/recipe.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,8 +1026,8 @@ def install_python_package(self, arch, name=None, env=None, is_dir=True):
10261026
hpenv = env.copy()
10271027
with current_directory(self.get_build_dir(arch.arch)):
10281028
shprint(hostpython, '-m', 'pip', 'install', '.',
1029-
'--compile',
1030-
f'--root={self.ctx.get_python_install_dir(arch.arch)}',
1029+
'--compile', '--target',
1030+
self.ctx.get_python_install_dir(arch.arch),
10311031
_env=hpenv, *self.setup_extra_args
10321032
)
10331033

@@ -1048,7 +1048,6 @@ def install_hostpython_package(self, arch):
10481048
real_hostpython = sh.Command(self.real_hostpython_location)
10491049
shprint(real_hostpython, '-m', 'pip', 'install', '.',
10501050
'--compile',
1051-
'--install-lib=Lib/site-packages',
10521051
'--root={}'.format(self._host_recipe.site_root),
10531052
_env=env, *self.setup_extra_args)
10541053

pythonforandroid/recipes/python3/__init__.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -389,18 +389,12 @@ def create_python_bundle(self, dirn, arch):
389389
place.
390390
"""
391391
# Todo: find a better way to find the build libs folder
392-
modules_build_dir = join(
392+
modules_build_dir = glob.glob(join(
393393
self.get_build_dir(arch.arch),
394394
'android-build',
395395
'build',
396-
'lib.{}{}-{}-{}'.format(
397-
# android is now supported platform
398-
"android" if self._p_version.minor >= 13 else "linux",
399-
'2' if self.version[0] == '2' else '',
400-
arch.command_prefix.split('-')[0],
401-
self.major_minor_version_string
402-
))
403-
396+
'lib.*'
397+
))[0]
404398
# Compile to *.pyc the python modules
405399
self.compile_python_files(modules_build_dir)
406400
# Compile to *.pyc the standard python library

tests/recipes/test_python3.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import unittest
2+
import glob
23

34
from os.path import join
45
from unittest import mock
@@ -174,14 +175,12 @@ def test_create_python_bundle(
174175
self.recipe.create_python_bundle(fake_compile_dir, self.arch)
175176

176177
recipe_build_dir = self.recipe.get_build_dir(self.arch.arch)
177-
modules_build_dir = join(
178+
modules_build_dir = glob.glob(join(
178179
recipe_build_dir,
179180
'android-build',
180181
'build',
181-
'lib.android-{}-{}'.format(
182-
self.arch.command_prefix.split('-')[0],
183-
self.recipe.major_minor_version_string
184-
))
182+
'lib.*'
183+
))[0]
185184
expected_sp_paths = [
186185
modules_build_dir,
187186
join(recipe_build_dir, 'Lib'),

0 commit comments

Comments
 (0)