diff --git a/news/12579.bugfix.rst b/news/12579.bugfix.rst new file mode 100644 index 00000000000..df189e8fbff --- /dev/null +++ b/news/12579.bugfix.rst @@ -0,0 +1 @@ +Remove duplication in invalid wheel error message diff --git a/src/pip/_internal/metadata/importlib/_dists.py b/src/pip/_internal/metadata/importlib/_dists.py index 26370facf28..8591029f16e 100644 --- a/src/pip/_internal/metadata/importlib/_dists.py +++ b/src/pip/_internal/metadata/importlib/_dists.py @@ -133,8 +133,6 @@ def from_wheel(cls, wheel: Wheel, name: str) -> BaseDistribution: dist = WheelDistribution.from_zipfile(zf, name, wheel.location) except zipfile.BadZipFile as e: raise InvalidWheel(wheel.location, name) from e - except UnsupportedWheel as e: - raise UnsupportedWheel(f"{name} has an invalid wheel, {e}") return cls(dist, dist.info_location, pathlib.PurePosixPath(wheel.location)) @property diff --git a/src/pip/_internal/utils/wheel.py b/src/pip/_internal/utils/wheel.py index 3551f8f19bc..f85aee8a3f9 100644 --- a/src/pip/_internal/utils/wheel.py +++ b/src/pip/_internal/utils/wheel.py @@ -28,7 +28,7 @@ def parse_wheel(wheel_zip: ZipFile, name: str) -> Tuple[str, Message]: metadata = wheel_metadata(wheel_zip, info_dir) version = wheel_version(metadata) except UnsupportedWheel as e: - raise UnsupportedWheel(f"{name} has an invalid wheel, {str(e)}") + raise UnsupportedWheel(f"{name} has an invalid wheel, {e}") check_compatibility(version, name)