From 80da50308a4342e09313fd7bbc63e40ecb88d755 Mon Sep 17 00:00:00 2001 From: Robert Kirkman Date: Fri, 27 Mar 2026 21:31:46 -0500 Subject: [PATCH 1/3] gh-146541: Allow building the Android testbed for 32-bit targets This allows building the Android testbed for 32-bit targets using the prebuilt 32-bit dependencies that are already available here: https://github.com/beeware/cpython-android-source-deps/releases , adding the target triplets to match them, `arm-linux-androideabi` and `i686-linux-android`. This also adds the `arm` key to the dictionary used to convert the `machine` variable to an Android ABI in `sysconfig.get_platform()`, because when the Android testbed is being cross-compiled, it stores the contents of the first substring of `_PYTHON_HOST_PLATFORM` before the first `-` symbol in the `machine` variable, which the dictionary does not currently handle. --- Android/android.py | 7 ++++++- Android/testbed/app/build.gradle.kts | 2 ++ Lib/sysconfig/__init__.py | 8 ++++++-- Lib/test/test_sysconfig.py | 10 ++++++---- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Android/android.py b/Android/android.py index 317875ef336e0e..f523b0ac82721d 100755 --- a/Android/android.py +++ b/Android/android.py @@ -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") diff --git a/Android/testbed/app/build.gradle.kts b/Android/testbed/app/build.gradle.kts index 53cdc591fa35fd..7529fdb8f7852f 100644 --- a/Android/testbed/app/build.gradle.kts +++ b/Android/testbed/app/build.gradle.kts @@ -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", ) diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py index 1418293dcbac0b..47415adce04c2c 100644 --- a/Lib/sysconfig/__init__.py +++ b/Lib/sysconfig/__init__.py @@ -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 -- diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index 6cd568eb3d0412..e6433f76a977b3 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -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+', @@ -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") From b2d3a75f3f73e587b7b5aa8759fb3cd8fe440141 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sat, 28 Mar 2026 02:48:52 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Build/2026-03-28-02-48-51.gh-issue-146541.k-zlM6.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Build/2026-03-28-02-48-51.gh-issue-146541.k-zlM6.rst diff --git a/Misc/NEWS.d/next/Build/2026-03-28-02-48-51.gh-issue-146541.k-zlM6.rst b/Misc/NEWS.d/next/Build/2026-03-28-02-48-51.gh-issue-146541.k-zlM6.rst new file mode 100644 index 00000000000000..351071b0becf66 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-03-28-02-48-51.gh-issue-146541.k-zlM6.rst @@ -0,0 +1 @@ +The Android testbed can now be built for 32-bit ARM and x86 targets. From c92b23e726385d8d1f482a3499d6590b4b1374c9 Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Fri, 3 Apr 2026 13:04:43 +0100 Subject: [PATCH 3/3] Update to zstd-1.5.7-2 --- Android/android.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Android/android.py b/Android/android.py index f523b0ac82721d..f8829e5330660d 100755 --- a/Android/android.py +++ b/Android/android.py @@ -214,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)