@@ -490,6 +490,11 @@ def name(self):
490490 """Return the 'Name' metadata for the distribution package."""
491491 return self .metadata ['Name' ]
492492
493+ @property
494+ def _normalized_name (self ):
495+ """Return a normalized version of the name."""
496+ return Prepared .normalize (self .name )
497+
493498 @property
494499 def version (self ):
495500 """Return the 'Version' metadata for the distribution package."""
@@ -797,6 +802,12 @@ def read_text(self, filename):
797802 def locate_file (self , path ):
798803 return self ._path .parent / path
799804
805+ @property
806+ def _normalized_name (self ):
807+ stem = os .path .basename (str (self ._path ))
808+ name , sep , rest = stem .partition ('-' )
809+ return name
810+
800811
801812def distribution (distribution_name ):
802813 """Get the ``Distribution`` instance for the named package.
@@ -851,7 +862,8 @@ def entry_points(**params) -> Union[EntryPoints, SelectableGroups]:
851862
852863 :return: EntryPoints or SelectableGroups for all installed packages.
853864 """
854- unique = functools .partial (unique_everseen , key = operator .attrgetter ('name' ))
865+ norm_name = operator .attrgetter ('_normalized_name' )
866+ unique = functools .partial (unique_everseen , key = norm_name )
855867 eps = itertools .chain .from_iterable (
856868 dist .entry_points for dist in unique (distributions ())
857869 )
0 commit comments