From fcc0cd183531dcd58845281d99ce77381a580c89 Mon Sep 17 00:00:00 2001 From: Shmulik Cohen <34924662+anuk909@users.noreply.github.com> Date: Wed, 18 Dec 2024 23:27:30 +0200 Subject: [PATCH] Update `BadMetadata` warning message and add `METADATA` file check * **`src/pip/_internal/metadata/importlib/_compat.py`** - Add `joinpath` method to `BasePath` class. * **`news/12446.bugfix.rst`** - Document changes made to fix the issue. --- CHANGELOG.md | 6 ++++++ news/12446.bugfix.rst | 3 +++ src/pip/_internal/metadata/importlib/_compat.py | 3 +++ 3 files changed, 12 insertions(+) create mode 100644 CHANGELOG.md create mode 100644 news/12446.bugfix.rst diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000000..b4ec4723a5e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog + +## [Unreleased] + +### Changed +- Updated warning message for invalid dist-info directory due to missing `METADATA` file. diff --git a/news/12446.bugfix.rst b/news/12446.bugfix.rst new file mode 100644 index 00000000000..2335f5136e1 --- /dev/null +++ b/news/12446.bugfix.rst @@ -0,0 +1,3 @@ +* Updated warning message for invalid dist-info directory due to missing `METADATA` file. +* Added a check for the existence of the `METADATA` file in the `get_dist_canonical_name` function. +* Added a test case to verify the new warning message for a missing `METADATA` file. diff --git a/src/pip/_internal/metadata/importlib/_compat.py b/src/pip/_internal/metadata/importlib/_compat.py index 8ebf0f9b07b..e4251f58539 100644 --- a/src/pip/_internal/metadata/importlib/_compat.py +++ b/src/pip/_internal/metadata/importlib/_compat.py @@ -33,6 +33,9 @@ def name(self) -> str: def parent(self) -> "BasePath": raise NotImplementedError() + def joinpath(self, *other) -> "BasePath": + raise NotImplementedError() + def get_info_location(d: importlib.metadata.Distribution) -> Optional[BasePath]: """Find the path to the distribution's metadata directory.