Skip to content

Commit

Permalink
fix: macos platform tags
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Jul 3, 2024
1 parent 3e21350 commit 7c0f9ea
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/dep_logic/tags/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,10 @@ def get_minimum_manylinux_minor(self) -> int | None:
return None

def get_mac_binary_formats(self) -> list[str]:
formats = [self.value]
if self == Arch.Aarch64:
formats = ["arm64"]
else:
formats = [self.value]

if self == Arch.X86_64:
formats.extend(["intel", "fat64", "fat32"])
Expand Down
2 changes: 1 addition & 1 deletion src/dep_logic/tags/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def from_spec(
cls,
requires_python: str,
platform: str,
implementation: str,
implementation: str = "cpython",
gil_disabled: bool = False,
) -> Self:
return cls(
Expand Down
14 changes: 14 additions & 0 deletions tests/tags/test_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ def test_check_wheel_tags():
wheels = [
"protobuf-5.27.2-cp310-abi3-win32.whl",
"protobuf-5.27.2-cp310-abi3-win_amd64.whl",
"protobuf-5.27.2-cp310-cp310-macosx_12_0_arm64.whl",
"protobuf-5.27.2-cp38-abi3-macosx_10_9_universal2.whl",
"protobuf-5.27.2-cp38-abi3-manylinux2014_aarch64.whl",
"protobuf-5.27.2-cp38-abi3-manylinux2014_x86_64.whl",
Expand Down Expand Up @@ -39,3 +40,16 @@ def test_check_wheel_tags():
"protobuf-5.27.2-cp39-cp39-win_amd64.whl",
"protobuf-5.27.2-py3-none-any.whl",
]

macos_env = EnvSpec.from_spec(">=3.9", "macos", "cpython")
wheel_compats = {
f: c
for f, c in {f: macos_env.wheel_compatibility(f) for f in wheels}.items()
if c is not None
}
filtered_wheels = sorted(wheel_compats, key=wheel_compats.__getitem__, reverse=True)
assert filtered_wheels == [
"protobuf-5.27.2-cp310-cp310-macosx_12_0_arm64.whl",
"protobuf-5.27.2-cp38-abi3-macosx_10_9_universal2.whl",
"protobuf-5.27.2-py3-none-any.whl",
]

0 comments on commit 7c0f9ea

Please sign in to comment.