Skip to content

Commit 5966592

Browse files
robertkirkmanmiss-islington
authored andcommitted
gh-145616: Detect Android sysconfig ABI correctly on 32-bit ARM Android on 64-bit ARM kernel (GH-145617)
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, so apply the same `armeabi_v7a` Android ABI to them, which works. (cherry picked from commit 3a2b81e) Co-authored-by: Robert Kirkman <31490854+robertkirkman@users.noreply.github.com>
1 parent 8a25840 commit 5966592

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

Lib/sysconfig/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,11 +698,15 @@ def get_platform():
698698
release = get_config_var("ANDROID_API_LEVEL")
699699

700700
# Wheel tags use the ABI names from Android's own tools.
701+
# When Python is running on 32-bit ARM Android on a 64-bit ARM kernel,
702+
# 'os.uname().machine' is 'armv8l'. Such devices run the same userspace
703+
# code as 'armv7l' devices.
701704
machine = {
702705
"x86_64": "x86_64",
703706
"i686": "x86",
704707
"aarch64": "arm64_v8a",
705708
"armv7l": "armeabi_v7a",
709+
"armv8l": "armeabi_v7a",
706710
}[machine]
707711
elif osname == "linux":
708712
# At least on Linux/Intel, 'machine' is the processor --

Lib/test/test_sysconfig.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ def test_get_platform(self):
379379
'i686': 'x86',
380380
'aarch64': 'arm64_v8a',
381381
'armv7l': 'armeabi_v7a',
382+
'armv8l': 'armeabi_v7a',
382383
}.items():
383384
with self.subTest(machine):
384385
self._set_uname(('Linux', 'localhost', '3.18.91+',
@@ -587,6 +588,7 @@ def test_android_ext_suffix(self):
587588
"i686": "i686-linux-android",
588589
"aarch64": "aarch64-linux-android",
589590
"armv7l": "arm-linux-androideabi",
591+
"armv8l": "arm-linux-androideabi",
590592
}[machine]
591593
self.assertEndsWith(suffix, f"-{expected_triplet}.so")
592594

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Detect Android sysconfig ABI correctly on 32-bit ARM Android on 64-bit ARM kernel

0 commit comments

Comments
 (0)