From d343391c20f8f6cc89a61a6f1573522c59d3d7a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= Date: Sat, 23 Nov 2024 02:12:48 +0200 Subject: [PATCH 1/2] Fixed wrong wheel file names in converted pure-Python eggs/wininsts Fixes #644. --- docs/news.rst | 5 +++++ src/wheel/cli/convert.py | 3 +-- tests/cli/test_convert.py | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/news.rst b/docs/news.rst index 781ce96d..5f1311c6 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -1,6 +1,11 @@ Release Notes ============= +**UNRELEASED** + +- Fixed pure Python wheels converted from eggs and wininst files having the ABI tag in + the file name + **0.45.0 (2024-11-08)** - Refactored the ``convert`` command to not need setuptools to be installed diff --git a/src/wheel/cli/convert.py b/src/wheel/cli/convert.py index ec5ecf3a..61d4775c 100644 --- a/src/wheel/cli/convert.py +++ b/src/wheel/cli/convert.py @@ -122,8 +122,8 @@ def __init__(self, path: Path): self.version = match.group("ver") if pyver := match.group("pyver"): self.pyver = pyver.replace(".", "") - self.abi = self.pyver.replace("py", "cp") if arch := match.group("arch"): + self.abi = self.pyver.replace("py", "cp") self.platform = normalize(arch) self.metadata = Message() @@ -225,7 +225,6 @@ def __init__(self, path: Path): self.platform = normalize(match.group("platform")) if pyver := match.group("pyver"): self.pyver = pyver.replace(".", "") - self.abi = pyver.replace("py", "cp") # Look for an .egg-info directory and any .pyd files for more precise info egg_info_found = pyd_found = False diff --git a/tests/cli/test_convert.py b/tests/cli/test_convert.py index a1bfd5d1..62884c2d 100644 --- a/tests/cli/test_convert.py +++ b/tests/cli/test_convert.py @@ -176,6 +176,16 @@ def egg_path(arch: str, pyver: str | None, tmp_path: Path) -> str: return str(bdist_path) +@pytest.fixture +def expected_wheel_filename(pyver: str | None, arch: str) -> str: + if arch != "any": + pyver = pyver.replace(".", "") if pyver else "py2.py3" + abiver = pyver.replace("py", "cp") + return f"sampledist-1.0.0-{pyver}-{abiver}-{arch}.whl" + else: + return "sampledist-1.0.0-py2.py3-none-any.whl" + + def test_egg_re() -> None: """Make sure egg_info_re matches.""" egg_names_path = os.path.join(os.path.dirname(__file__), "eggnames.txt") @@ -191,10 +201,12 @@ def test_convert_egg_file( tmp_path: Path, arch: str, expected_wheelfile: bytes, + expected_wheel_filename: str, capsys: CaptureFixture, ) -> None: convert([egg_path], str(tmp_path), verbose=True) wheel_path = next(path for path in tmp_path.iterdir() if path.suffix == ".whl") + assert wheel_path.name == expected_wheel_filename with WheelFile(wheel_path) as wf: assert wf.read("sampledist-1.0.0.dist-info/METADATA") == EXPECTED_METADATA assert wf.read("sampledist-1.0.0.dist-info/WHEEL") == expected_wheelfile @@ -207,8 +219,10 @@ def test_convert_egg_directory( egg_path: str, tmp_path: Path, tmp_path_factory: TempPathFactory, + pyver: str | None, arch: str, expected_wheelfile: bytes, + expected_wheel_filename: str, capsys: CaptureFixture, ) -> None: with zipfile.ZipFile(egg_path) as egg_file: @@ -218,6 +232,7 @@ def test_convert_egg_directory( convert([str(egg_dir_path)], str(tmp_path), verbose=True) wheel_path = next(path for path in tmp_path.iterdir() if path.suffix == ".whl") + assert wheel_path.name == expected_wheel_filename with WheelFile(wheel_path) as wf: assert wf.read("sampledist-1.0.0.dist-info/METADATA") == EXPECTED_METADATA assert wf.read("sampledist-1.0.0.dist-info/WHEEL") == expected_wheelfile @@ -231,10 +246,12 @@ def test_convert_bdist_wininst( tmp_path: Path, arch: str, expected_wheelfile: bytes, + expected_wheel_filename: str, capsys: CaptureFixture, ) -> None: convert([bdist_wininst_path], str(tmp_path), verbose=True) wheel_path = next(path for path in tmp_path.iterdir() if path.suffix == ".whl") + assert wheel_path.name == expected_wheel_filename with WheelFile(wheel_path) as wf: assert ( wf.read("sampledist-1.0.0.data/scripts/somecommand") From 7855525de4093257e7bfb434877265e227356566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= Date: Sat, 23 Nov 2024 02:14:12 +0200 Subject: [PATCH 2/2] Created a new release --- docs/news.rst | 2 +- src/wheel/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/news.rst b/docs/news.rst index 5f1311c6..08127b89 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -1,7 +1,7 @@ Release Notes ============= -**UNRELEASED** +**0.45.1 (2024-11-23)** - Fixed pure Python wheels converted from eggs and wininst files having the ABI tag in the file name diff --git a/src/wheel/__init__.py b/src/wheel/__init__.py index 88334872..3ab8f72d 100644 --- a/src/wheel/__init__.py +++ b/src/wheel/__init__.py @@ -1,3 +1,3 @@ from __future__ import annotations -__version__ = "0.45.0" +__version__ = "0.45.1"