Skip to content

Commit 0e383fa

Browse files
committed
Lowercase the machine in wheel platform tags
platform.machine() returns "AMD64" (or "ARM64") on Windows, so wheels were tagged win_AMD64 instead of the PEP 425 lowercase win_amd64. pip tolerates this because packaging.tags.Tag lowercases on parse, but uv rejects the wheel as incompatible with the platform. Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
1 parent 19dd006 commit 0e383fa

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

hatch_cpp/plugin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def _wheel_tag(platform: str, machine: str, version_major: int, version_minor: i
2828
os_name = "linux"
2929
else:
3030
os_name = "win"
31+
# platform.machine() reports AMD64/ARM64 on Windows, but PEP 425 platform tags are lowercase
32+
machine = machine.lower()
3133
abi = "abi3" if abi3 else f"cp{version_major}{version_minor}"
3234
return f"cp{version_major}{version_minor}-{abi}-{os_name}_{machine}"
3335

hatch_cpp/tests/test_structs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ def test_pyodide_wheel_tag_requires_abi_version(self, monkeypatch: pytest.Monkey
8787
with pytest.raises(ValueError, match="PYODIDE_ABI_VERSION"):
8888
_wheel_tag("emscripten", "wasm32", 3, 14, False)
8989

90+
def test_wheel_tag_machine_is_lowercased(self):
91+
assert _wheel_tag("win32", "AMD64", 3, 11, False) == "cp311-cp311-win_amd64"
92+
assert _wheel_tag("win32", "ARM64", 3, 11, True) == "cp311-abi3-win_arm64"
93+
assert _wheel_tag("linux", "x86_64", 3, 11, False) == "cp311-cp311-linux_x86_64"
94+
9095
def test_pyodide_build_plan_compiles_objects_before_linking(self, monkeypatch: pytest.MonkeyPatch):
9196
monkeypatch.setenv("PYODIDE_ABI_VERSION", "2026_0")
9297
monkeypatch.setenv("CC", "/toolchain/cc")

0 commit comments

Comments
 (0)