Skip to content

Commit 6122c55

Browse files
committed
Fix sysconfig.get_platform() on Android cross-compilation
Signed-off-by: Filipe Laíns <[email protected]>
1 parent 4dd2f58 commit 6122c55

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

Lib/sysconfig/__init__.py

+16-17
Original file line numberDiff line numberDiff line change
@@ -678,23 +678,22 @@ def get_platform():
678678
machine = machine.replace(' ', '_')
679679
machine = machine.replace('/', '-')
680680

681-
if osname[:5] == "linux":
682-
if sys.platform == "android":
683-
osname = "android"
684-
release = get_config_var("ANDROID_API_LEVEL")
685-
686-
# Wheel tags use the ABI names from Android's own tools.
687-
machine = {
688-
"x86_64": "x86_64",
689-
"i686": "x86",
690-
"aarch64": "arm64_v8a",
691-
"armv7l": "armeabi_v7a",
692-
}[machine]
693-
else:
694-
# At least on Linux/Intel, 'machine' is the processor --
695-
# i386, etc.
696-
# XXX what about Alpha, SPARC, etc?
697-
return f"{osname}-{machine}"
681+
if osname == "android" or sys.platform == "android":
682+
osname = "android"
683+
release = get_config_var("ANDROID_API_LEVEL")
684+
685+
# Wheel tags use the ABI names from Android's own tools.
686+
machine = {
687+
"x86_64": "x86_64",
688+
"i686": "x86",
689+
"aarch64": "arm64_v8a",
690+
"armv7l": "armeabi_v7a",
691+
}[machine]
692+
elif osname == "linux":
693+
# At least on Linux/Intel, 'machine' is the processor --
694+
# i386, etc.
695+
# XXX what about Alpha, SPARC, etc?
696+
return f"{osname}-{machine}"
698697
elif osname[:5] == "sunos":
699698
if release[0] >= "5": # SunOS 5 == Solaris 2
700699
osname = "solaris"

0 commit comments

Comments
 (0)