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")