Skip to content

Commit

Permalink
fix PathDistribution._normalized_name implementation
Browse files Browse the repository at this point in the history
- 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).
  • Loading branch information
benoit-pierre authored and jaraco committed May 21, 2022
1 parent 6eb6f71 commit 45b8841
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion importlib_metadata/__init__.py
Expand Up @@ -956,7 +956,10 @@ def _normalized_name(self):
normalized name from the file system path.
"""
stem = os.path.basename(str(self._path))
return self._name_from_stem(stem) or super()._normalized_name
return (
pass_none(Prepared.normalize)(self._name_from_stem(stem))
or super()._normalized_name
)

@staticmethod
def _name_from_stem(stem):
Expand Down

0 comments on commit 45b8841

Please sign in to comment.