Support Python 3.13+ on Android (#18301)

Python 3.13+ changed how it reports platform information on Android; see
https://peps.python.org/pep-0738/#architectures

Here we add support for the new platform values, without which uv will
fail due to an unrecognized interpreter.

Closes #18296
Closes #18285
Closes https://github.com/astral-sh/uv/issues/18313

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Zanie Blue
2026-03-06 07:42:21 -06:00
committed by GitHub
parent 6055369bb1
commit 8b82d17f44
@@ -487,6 +487,8 @@ def get_operating_system_and_architecture():
"minor": glibc_version[1],
}
elif hasattr(sys, "getandroidapilevel"):
# On Python <3.13, Android reports itself as "linux"
# See `operation_system == "android"` branch for Python 3.13+ below
operating_system = {
"name": "android",
"api_level": sys.getandroidapilevel(),
@@ -550,6 +552,26 @@ def get_operating_system_and_architecture():
"major": int(version[0]),
"minor": int(version[1]),
}
elif operating_system == "android":
# Python 3.13+ supports Android. We map the Android ABIs to our standard architectures.
#
# See:
#
# - https://peps.python.org/pep-0738/
# - https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#android
# - https://developer.android.com/ndk/guides/abis#sa
android_abi_to_arch = {
"arm64_v8a": "aarch64",
"armeabi_v7a": "armv7l",
"x86": "i686",
"x86_64": "x86_64",
}
architecture = android_abi_to_arch.get(architecture, architecture)
operating_system = {
"name": "android",
"api_level": sys.getandroidapilevel(),
}
elif operating_system in [
"freebsd",
"netbsd",