Skip to content

Commit d0dbd6d

Browse files
authored
Add support for iOS and Android platform tags. (#17559)
* Add support for iOS and Android platform tags. * Use 'API level' not 'SDK' for Android tags. * Correct linting issues.
1 parent 10ed8ea commit d0dbd6d

File tree

4 files changed

+86
-0
lines changed

4 files changed

+86
-0
lines changed

tests/unit/forklift/test_legacy.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,6 +2734,16 @@ def test_upload_attestation_fails_without_oidc_publisher(
27342734
"macosx_11_0_x86_64",
27352735
"macosx_10_15_arm64",
27362736
"macosx_11_10_universal2",
2737+
"ios_13_0_arm64_iphoneos",
2738+
"ios_13_0_arm64_iphonesimulator",
2739+
"ios_13_0_x86_64_iphonesimulator",
2740+
"ios_15_4_arm64_iphoneos",
2741+
"ios_15_4_arm64_iphonesimulator",
2742+
"ios_15_4_x86_64_iphonesimulator",
2743+
"android_27_armeabi_v7a",
2744+
"android_27_arm64_v8a",
2745+
"android_27_x86",
2746+
"android_27_x86_64",
27372747
# A real tag used by e.g. some numpy wheels
27382748
(
27392749
"macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64."

tests/unit/utils/test_wheel.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,46 @@
5757
"cryptography-42.0.5-cp37-abi3-macosx_10_12_universal2.whl",
5858
["CPython 3.7+", "macOS 10.12+ universal2 (ARM64, x86-64)"],
5959
),
60+
(
61+
"cryptography-42.0.5-cp313-cp313-android_27_armeabi_v7a.whl",
62+
["Android API level 27+ ARM EABI v7a", "CPython 3.13"],
63+
),
64+
(
65+
"cryptography-42.0.5-cp313-cp313-android_27_arm64_v8a.whl",
66+
["Android API level 27+ ARM64 v8a", "CPython 3.13"],
67+
),
68+
(
69+
"cryptography-42.0.5-cp313-cp313-android_27_x86.whl",
70+
["Android API level 27+ x86", "CPython 3.13"],
71+
),
72+
(
73+
"cryptography-42.0.5-cp313-cp313-android_27_x86_64.whl",
74+
["Android API level 27+ x86-64", "CPython 3.13"],
75+
),
76+
(
77+
"cryptography-42.0.5-cp313-abi3-android_16_armeabi_v7a.whl",
78+
["Android API level 16+ ARM EABI v7a", "CPython 3.13+"],
79+
),
80+
(
81+
"cryptography-42.0.5-cp313-cp313-iOS_15_6_arm64_iphoneos.whl",
82+
["CPython 3.13", "iOS 15.6+ ARM64 Device"],
83+
),
84+
(
85+
"cryptography-42.0.5-cp313-cp313-iOS_15_6_arm64_iphonesimulator.whl",
86+
["CPython 3.13", "iOS 15.6+ ARM64 Simulator"],
87+
),
88+
(
89+
"cryptography-42.0.5-cp313-cp313-iOS_15_6_x86_64_iphonesimulator.whl",
90+
["CPython 3.13", "iOS 15.6+ x86-64 Simulator"],
91+
),
92+
(
93+
"cryptography-42.0.5-cp313-abi3-iOS_13_0_arm64_iphoneos.whl",
94+
["CPython 3.13+", "iOS 13.0+ ARM64 Device"],
95+
),
96+
(
97+
"cryptography-42.0.5-cp313-abi3-iOS_13_0_arm64_iphonesimulator.whl",
98+
["CPython 3.13+", "iOS 13.0+ ARM64 Simulator"],
99+
),
60100
(
61101
"pgf-1.0-pp27-pypy_73-manylinux2010_x86_64.whl",
62102
["PyPy", "manylinux: glibc 2.12+ x86-64"],

warehouse/forklift/legacy.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,22 @@
154154
"15",
155155
}
156156

157+
_ios_platform_re = re.compile(
158+
r"ios_(\d+)_(\d+)_(?P<arch>.*)_(iphoneos|iphonesimulator)"
159+
)
160+
_ios_arches = {
161+
"arm64",
162+
"x86_64",
163+
}
164+
165+
_android_platform_re = re.compile(r"android_(\d+)_(?P<arch>.*)")
166+
_android_arches = {
167+
"armeabi_v7a",
168+
"arm64_v8a",
169+
"x86",
170+
"x86_64",
171+
}
172+
157173
# manylinux pep600 and musllinux pep656 are a little more complicated:
158174
_linux_platform_re = re.compile(r"(?P<libc>(many|musl))linux_(\d+)_(\d+)_(?P<arch>.*)")
159175
_jointlinux_arches = {
@@ -184,6 +200,12 @@ def _valid_platform_tag(platform_tag):
184200
return m.group("arch") in _musllinux_arches
185201
if m and m.group("libc") == "many":
186202
return m.group("arch") in _manylinux_arches
203+
m = _ios_platform_re.match(platform_tag)
204+
if m and m.group("arch") in _ios_arches:
205+
return True
206+
m = _android_platform_re.match(platform_tag)
207+
if m and m.group("arch") in _android_arches:
208+
return True
187209
return False
188210

189211

warehouse/utils/wheel.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,25 @@
4040
re.compile(r"^macosx_(\d+)_(\d+)_(.*?)$"),
4141
lambda m: f"macOS {m.group(1)}.{m.group(2)}+ {_normalize_arch(m.group(3))}",
4242
),
43+
(
44+
re.compile(r"^android_(\d+)_(.*?)$"),
45+
lambda m: f"Android API level {m.group(1)}+ {_normalize_arch(m.group(2))}",
46+
),
47+
(
48+
re.compile(r"^ios_(\d+)_(\d+)_(.*?)_iphoneos$"),
49+
lambda m: f"iOS {m.group(1)}.{m.group(2)}+ {_normalize_arch(m.group(3))} Device", # noqa: E501
50+
),
51+
(
52+
re.compile(r"^ios_(\d+)_(\d+)_(.*?)_iphonesimulator$"),
53+
lambda m: f"iOS {m.group(1)}.{m.group(2)}+ {_normalize_arch(m.group(3))} Simulator", # noqa: E501
54+
),
4355
]
4456

4557
_ARCHS = {
4658
"amd64": "x86-64",
4759
"aarch64": "ARM64",
60+
"armeabi_v7a": "ARM EABI v7a",
61+
"arm64_v8a": "ARM64 v8a",
4862
"x86_64": "x86-64",
4963
"intel": "Intel (x86-64, i386)",
5064
"fat": "fat (i386, PPC)",

0 commit comments

Comments
 (0)