Allows building the Android testbed for 32-bit targets, adding the target triplets
`arm-linux-androideabi` and `i686-linux-android`.
Co-authored-by: Malcolm Smith <smith@chaquo.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")
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)
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]
elif osname == "linux":
# 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.assertEndsWith(suffix, f"-{expected_triplet}.so")
--- /dev/null
+The Android testbed can now be built for 32-bit ARM and x86 targets.