Skip to content

Commit

Permalink
Update BadMetadata warning message and add METADATA file check
Browse files Browse the repository at this point in the history
* **`src/pip/_internal/metadata/importlib/_compat.py`**
  - Add `joinpath` method to `BasePath` class.
* **`news/12446.bugfix.rst`**
  - Document changes made to fix the issue.
  • Loading branch information
anuk909 committed Dec 18, 2024
1 parent 22c094e commit fcc0cd1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog

## [Unreleased]

### Changed
- Updated warning message for invalid dist-info directory due to missing `METADATA` file.
3 changes: 3 additions & 0 deletions news/12446.bugfix.rst
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 3 additions & 0 deletions src/pip/_internal/metadata/importlib/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit fcc0cd1

Please sign in to comment.