@@ -498,6 +498,11 @@ def name(self):
498498 """Return the 'Name' metadata for the distribution package."""
499499 return self .metadata ['Name' ]
500500
501+ @property
502+ def _normalized_name (self ):
503+ """Return a normalized version of the name."""
504+ return Prepared .normalize (self .name )
505+
501506 @property
502507 def version (self ):
503508 """Return the 'Version' metadata for the distribution package."""
@@ -805,6 +810,12 @@ def read_text(self, filename):
805810 def locate_file (self , path ):
806811 return self ._path .parent / path
807812
813+ @property
814+ def _normalized_name (self ):
815+ stem = os .path .basename (str (self ._path ))
816+ name , sep , rest = stem .partition ('-' )
817+ return name
818+
808819
809820def distribution (distribution_name ):
810821 """Get the ``Distribution`` instance for the named package.
@@ -859,7 +870,8 @@ def entry_points(**params) -> Union[EntryPoints, SelectableGroups]:
859870
860871 :return: EntryPoints or SelectableGroups for all installed packages.
861872 """
862- unique = functools .partial (unique_everseen , key = operator .attrgetter ('name' ))
873+ norm_name = operator .attrgetter ('_normalized_name' )
874+ unique = functools .partial (unique_everseen , key = norm_name )
863875 eps = itertools .chain .from_iterable (
864876 dist .entry_points for dist in unique (distributions ())
865877 )
0 commit comments