Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Android/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@
TESTBED_DIR = ANDROID_DIR / "testbed"
CROSS_BUILD_DIR = PYTHON_DIR / "cross-build"

HOSTS = ["aarch64-linux-android", "x86_64-linux-android"]
HOSTS = [
"aarch64-linux-android",
"arm-linux-androideabi",
"i686-linux-android",
"x86_64-linux-android",
]
APP_ID = "org.python.testbed"
DECODE_ARGS = ("UTF-8", "backslashreplace")

Expand Down Expand Up @@ -209,7 +214,7 @@ def unpack_deps(host, prefix_dir):
os.chdir(prefix_dir)
deps_url = "https://github.com/beeware/cpython-android-source-deps/releases/download"
for name_ver in ["bzip2-1.0.8-3", "libffi-3.4.4-3", "openssl-3.5.5-0",
"sqlite-3.50.4-0", "xz-5.4.6-1", "zstd-1.5.7-1"]:
"sqlite-3.50.4-0", "xz-5.4.6-1", "zstd-1.5.7-2"]:
filename = f"{name_ver}-{host}.tar.gz"
download(f"{deps_url}/{name_ver}/{filename}")
shutil.unpack_archive(filename)
Expand Down
2 changes: 2 additions & 0 deletions Android/testbed/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ val inSourceTree = (

val KNOWN_ABIS = mapOf(
"aarch64-linux-android" to "arm64-v8a",
"arm-linux-androideabi" to "armeabi-v7a",
"i686-linux-android" to "x86",
"x86_64-linux-android" to "x86_64",
)

Expand Down
8 changes: 6 additions & 2 deletions Lib/sysconfig/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,12 +697,16 @@ def get_platform():
# When Python is running on 32-bit ARM Android on a 64-bit ARM kernel,
# 'os.uname().machine' is 'armv8l'. Such devices run the same userspace
# code as 'armv7l' devices.
# During the build process of the Android testbed when targeting 32-bit ARM,
# '_PYTHON_HOST_PLATFORM' is 'arm-linux-androideabi', so 'machine' becomes
# 'arm'.
machine = {
"x86_64": "x86_64",
"i686": "x86",
"aarch64": "arm64_v8a",
"arm": "armeabi_v7a",
"armv7l": "armeabi_v7a",
"armv8l": "armeabi_v7a",
"i686": "x86",
"x86_64": "x86_64",
}[machine]
elif osname == "linux":
# At least on Linux/Intel, 'machine' is the processor --
Expand Down
10 changes: 6 additions & 4 deletions Lib/test/test_sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,12 @@ def test_get_platform(self):
sys.platform = 'android'
get_config_vars()['ANDROID_API_LEVEL'] = 9
for machine, abi in {
'x86_64': 'x86_64',
'i686': 'x86',
'aarch64': 'arm64_v8a',
'arm': 'armeabi_v7a',
'armv7l': 'armeabi_v7a',
'armv8l': 'armeabi_v7a',
'i686': 'x86',
'x86_64': 'x86_64',
}.items():
with self.subTest(machine):
self._set_uname(('Linux', 'localhost', '3.18.91+',
Expand Down Expand Up @@ -580,11 +581,12 @@ def test_android_ext_suffix(self):
machine = platform.machine()
suffix = sysconfig.get_config_var('EXT_SUFFIX')
expected_triplet = {
"x86_64": "x86_64-linux-android",
"i686": "i686-linux-android",
"aarch64": "aarch64-linux-android",
"arm": "arm-linux-androideabi",
"armv7l": "arm-linux-androideabi",
"armv8l": "arm-linux-androideabi",
"i686": "i686-linux-android",
"x86_64": "x86_64-linux-android",
}[machine]
self.assertEndsWith(suffix, f"-{expected_triplet}.so")

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The Android testbed can now be built for 32-bit ARM and x86 targets.
Loading