Skip to content

Commit 45b8841

Browse files
benoit-pierrejaraco
authored andcommitted
fix PathDistribution._normalized_name implementation
- apply PEP 503 normalization to the extracted names (e.g.: `zope..inter_face-4.2.dist-info` must yield the name `zope_inter_face`) `entry_points(…)` can yield the entry-points of a shadowed distribution. For example: with a version of `mypkg` in the system' site-packages directory when working from another development checkout of the same package (with a `mypkg.egg-info` directory mishandled by the first bug).
1 parent 6eb6f71 commit 45b8841

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

importlib_metadata/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,10 @@ def _normalized_name(self):
956956
normalized name from the file system path.
957957
"""
958958
stem = os.path.basename(str(self._path))
959-
return self._name_from_stem(stem) or super()._normalized_name
959+
return (
960+
pass_none(Prepared.normalize)(self._name_from_stem(stem))
961+
or super()._normalized_name
962+
)
960963

961964
@staticmethod
962965
def _name_from_stem(stem):

0 commit comments

Comments
 (0)