Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/pdm/backend/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def scheme_path(self, name: str, relative: str) -> str:
)
return f"{self.name_version}.data/{name}/{relative}"

def _get_platform_tags(self) -> tuple[str | None, str | None, str | None]:
def _get_platform_tags(
self,
) -> tuple[str | None, str | None, list[str] | str | None]:
python_tag: str | None = None
py_limited_api: str | None = None
plat_name: str | None = None
Expand Down Expand Up @@ -219,9 +221,14 @@ def _get_tag(self) -> str:
else:
impl = "py3"

platform = platform.lower().replace("-", "_").replace(".", "_") # type: ignore
if isinstance(platform, str):
platform = [platform]

platform = ".".join(
x.lower().replace("-", "_").replace(".", "_") for x in platform
)
tag = (impl, abi, platform)
return "-".join(tag) # type: ignore[arg-type]
return "-".join(tag)

def _write_dist_info(self, parent: Path) -> Path:
"""write the dist-info directory and return the path to it"""
Expand Down
10 changes: 9 additions & 1 deletion tests/test_wheel.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import sys
from pathlib import Path

Expand All @@ -13,10 +15,16 @@
[
("cp36", "abi3", "win_amd64", "cp36-abi3-win_amd64"),
("py3", "none", "win_amd64", "py3-none-win_amd64"),
(
"py3",
"none",
["manylinux_2_12_x86", "musllinux_1_1_x86"],
"py3-none-manylinux_2_12_x86.musllinux_1_1_x86",
),
],
)
def test_override_tags_in_wheel_filename(
python_tag: str, py_limited_api: str, plat_name: str, tag: str
python_tag: str, py_limited_api: str, plat_name: str | list[str], tag: str
) -> None:
project = FIXTURES / "projects/demo-cextension"
with wheel.WheelBuilder(
Expand Down