[3.12] gh-120910: Fix issue resolving relative paths outside site-packages. (GH-120911) (#120918)

Incorporates changes from importlib_metadata 7.2.1.
(cherry picked from commit 1ba0bb21ed)
This commit is contained in:
Jason R. Coombs 2024-06-23 13:30:18 -04:00 committed by GitHub
parent 673cabc23b
commit daef7de36f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 42 additions and 1 deletions

View file

@ -534,7 +534,7 @@ class Distribution(DeprecatedNonAbstract):
paths = (
(subdir / name)
.resolve()
.relative_to(self.locate_file('').resolve())
.relative_to(self.locate_file('').resolve(), walk_up=True)
.as_posix()
for name in text.splitlines()
)