Allows building the Android testbed for 32-bit targets, adding the target triplets
`arm-linux-androideabi` and `i686-linux-android`.
(cherry picked from commit
848bbe9ff21ae0a3ee412cc25843835ace4f75df)
Co-authored-by: Robert Kirkman <31490854+robertkirkman@users.noreply.github.com>
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")
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",
)
# 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]
else:
# At least on Linux/Intel, 'machine' is the processor --
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+',
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.assertTrue(suffix.endswith(f"-{expected_triplet}.so"),
f"{machine=}, {suffix=}")
--- /dev/null
+The Android testbed can now be built for 32-bit ARM and x86 targets.