Skip to content

Commit

Permalink
Correct handling of fat3 macOS wheels and eggs. (#17572)
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 authored Feb 7, 2025
1 parent ef958a6 commit 5c75fae
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
9 changes: 8 additions & 1 deletion tests/unit/forklift/test_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2722,7 +2722,14 @@ def test_upload_attestation_fails_without_oidc_publisher(
"manylinux_2_17_ppc64le",
"manylinux_3_0_s390x",
"musllinux_1_1_x86_64",
"macosx_10_6_intel",
"macosx_10_5_ppc",
"macosx_10_5_ppc64",
"macosx_10_5_i386",
"macosx_10_5_intel",
"macosx_10_5_fat",
"macosx_10_5_fat3",
"macosx_10_5_fat64",
"macosx_10_5_universal",
"macosx_10_13_x86_64",
"macosx_11_0_x86_64",
"macosx_10_15_arm64",
Expand Down
22 changes: 22 additions & 0 deletions tests/unit/utils/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
("filename", "expected_tags"),
[
("cryptography-42.0.5.tar.gz", ["Source"]),
("Pillow-2.5.0-py3.4-win-amd64.egg", ["Egg"]),
("Pillow-2.5.0-py3.4-win32.egg", ["Egg"]),
(
"cryptography-42.0.5-pp310-pypy310_pp73-win_amd64.whl",
["PyPy", "Windows x86-64"],
Expand All @@ -31,6 +33,26 @@
"cryptography-42.0.5-cp37-abi3-musllinux_1_2_x86_64.whl",
["CPython 3.7+", "musllinux: musl 1.2+ x86-64"],
),
(
"cryptography-42.0.5-cp37-abi3-macosx_10_5_intel.whl",
["CPython 3.7+", "macOS 10.5+ Intel (x86-64, i386)"],
),
(
"cryptography-42.0.5-cp37-abi3-macosx_10_5_fat.whl",
["CPython 3.7+", "macOS 10.5+ fat (i386, PPC)"],
),
(
"cryptography-42.0.5-cp37-abi3-macosx_10_5_fat3.whl",
["CPython 3.7+", "macOS 10.5+ fat3 (x86-64, i386, PPC)"],
),
(
"cryptography-42.0.5-cp37-abi3-macosx_10_5_fat64.whl",
["CPython 3.7+", "macOS 10.5+ fat64 (x86-64, PPC64)"],
),
(
"cryptography-42.0.5-cp37-abi3-macosx_10_5_universal.whl",
["CPython 3.7+", "macOS 10.5+ universal (x86-64, i386, PPC64, PPC)"],
),
(
"cryptography-42.0.5-cp37-abi3-macosx_10_12_universal2.whl",
["CPython 3.7+", "macOS 10.12+ universal2 (ARM64, x86-64)"],
Expand Down
2 changes: 1 addition & 1 deletion warehouse/forklift/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"arm64",
"intel",
"fat",
"fat32",
"fat3",
"fat64",
"universal",
"universal2",
Expand Down
9 changes: 8 additions & 1 deletion warehouse/utils/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
"amd64": "x86-64",
"aarch64": "ARM64",
"x86_64": "x86-64",
"intel": "Intel (x86-64, i386)",
"fat": "fat (i386, PPC)",
"fat3": "fat3 (x86-64, i386, PPC)",
"fat64": "fat64 (x86-64, PPC64)",
"universal": "universal (x86-64, i386, PPC64, PPC)",
"universal2": "universal2 (ARM64, x86-64)",
"arm64": "ARM64",
"armv7l": "ARMv7l",
Expand All @@ -61,7 +66,9 @@ def _format_version(s: str) -> str:


def filename_to_pretty_tags(filename: str) -> list[str]:
if not filename.endswith(".whl"):
if filename.endswith(".egg"):
return ["Egg"]
elif not filename.endswith(".whl"):
return ["Source"]

try:
Expand Down

0 comments on commit 5c75fae

Please sign in to comment.