Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions crates/uv-python/python/get_interpreter_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems vaguely worth including this one for clarity? I don't have strong feelings.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree

}
architecture = android_abi_to_arch.get(architecture, architecture)

operating_system = {
"name": "android",
"api_level": sys.getandroidapilevel(),
}
elif operating_system in [
"freebsd",
"netbsd",
Expand Down
Loading