From 0e383face46b0e4dc3d07a9adb2115cb9f68dcda Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Mon, 7 Sep 2026 13:12:09 -0400 Subject: [PATCH] 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> --- hatch_cpp/plugin.py | 2 ++ hatch_cpp/tests/test_structs.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/hatch_cpp/plugin.py b/hatch_cpp/plugin.py index dc79b94..a0480a9 100644 --- a/hatch_cpp/plugin.py +++ b/hatch_cpp/plugin.py @@ -28,6 +28,8 @@ def _wheel_tag(platform: str, machine: str, version_major: int, version_minor: i os_name = "linux" else: os_name = "win" + # platform.machine() reports AMD64/ARM64 on Windows, but PEP 425 platform tags are lowercase + machine = machine.lower() abi = "abi3" if abi3 else f"cp{version_major}{version_minor}" return f"cp{version_major}{version_minor}-{abi}-{os_name}_{machine}" diff --git a/hatch_cpp/tests/test_structs.py b/hatch_cpp/tests/test_structs.py index 456c7ae..64395fe 100644 --- a/hatch_cpp/tests/test_structs.py +++ b/hatch_cpp/tests/test_structs.py @@ -87,6 +87,11 @@ def test_pyodide_wheel_tag_requires_abi_version(self, monkeypatch: pytest.Monkey with pytest.raises(ValueError, match="PYODIDE_ABI_VERSION"): _wheel_tag("emscripten", "wasm32", 3, 14, False) + def test_wheel_tag_machine_is_lowercased(self): + assert _wheel_tag("win32", "AMD64", 3, 11, False) == "cp311-cp311-win_amd64" + assert _wheel_tag("win32", "ARM64", 3, 11, True) == "cp311-abi3-win_arm64" + assert _wheel_tag("linux", "x86_64", 3, 11, False) == "cp311-cp311-linux_x86_64" + def test_pyodide_build_plan_compiles_objects_before_linking(self, monkeypatch: pytest.MonkeyPatch): monkeypatch.setenv("PYODIDE_ABI_VERSION", "2026_0") monkeypatch.setenv("CC", "/toolchain/cc")