Skip to content
Draft
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion tests/unit/forklift/test_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2843,7 +2843,7 @@ def test_upload_attestation_fails_without_oidc_publisher(
"macosx_10_13_x86_64",
"macosx_11_0_x86_64",
"macosx_10_15_arm64",
"macosx_11_10_universal2",
"macosx_15_0_universal2",
"ios_13_0_arm64_iphoneos",
"ios_13_0_arm64_iphonesimulator",
"ios_13_0_x86_64_iphonesimulator",
Expand Down Expand Up @@ -3408,6 +3408,7 @@ def test_upload_fails_with_invalid_filename(
"linux_x86_64",
"linux_x86_64.win32",
"macosx_9_2_x86_64",
"macosx_11_2_arm64",
"macosx_16_2_arm64",
"macosx_10_15_amd64",
],
Expand Down
12 changes: 10 additions & 2 deletions warehouse/forklift/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"linux_armv7l",
}
# macosx is a little more complicated:
_macosx_platform_re = re.compile(r"macosx_(?P<major>\d+)_(\d+)_(?P<arch>.*)")
_macosx_platform_re = re.compile(r"macosx_(?P<major>\d+)_(?P<minor>\d+)_(?P<arch>.*)")
_macosx_arches = {
"ppc",
"ppc64",
Expand All @@ -133,8 +133,8 @@
"universal",
"universal2",
}
# macosx 10 is also supported, but with different rules
_macosx_major_versions = {
"10",
"11",
"12",
"13",
Expand Down Expand Up @@ -178,9 +178,17 @@ def _valid_platform_tag(platform_tag):
if platform_tag in _allowed_platforms:
return True
m = _macosx_platform_re.match(platform_tag)
# https://github.com/pypa/packaging.python.org/issues/1933
# There's two macosx formats: `macosx_10_{minor}` for the 10.x series where
# only the minor version ever increased, and `macosx_{major}_0` for the
# new release scheme where we don't know how many minor versions each
# release has.
if m and m.group("major") == "10" and m.group("arch") in _macosx_arches:
return True
if (
m
and m.group("major") in _macosx_major_versions
and m.group("minor") == "0"
and m.group("arch") in _macosx_arches
):
return True
Expand Down