@@ -53,7 +53,7 @@ def name(self):
5353
5454
5555class EntryPoint (
56- PyPy_repr , collections .namedtuple ('EntryPointBase' , 'name value group' )
56+ PyPy_repr , collections .namedtuple ('EntryPointBase' , 'dist name value group' )
5757):
5858 """An entry point as defined by Python packaging conventions.
5959
@@ -109,20 +109,20 @@ def extras(self):
109109 return list (re .finditer (r'\w+' , match .group ('extras' ) or '' ))
110110
111111 @classmethod
112- def _from_config (cls , config ):
112+ def _from_config (cls , dist , config ):
113113 return [
114- cls (name , value , group )
114+ cls (dist , name , value , group )
115115 for group in config .sections ()
116116 for name , value in config .items (group )
117117 ]
118118
119119 @classmethod
120- def _from_text (cls , text ):
120+ def _from_text (cls , dist , text ):
121121 config = ConfigParser (delimiters = '=' )
122122 # case sensitive: https://stackoverflow.com/q/1611799/812183
123123 config .optionxform = str
124124 config .read_string (text )
125- return EntryPoint ._from_config (config )
125+ return EntryPoint ._from_config (dist , config )
126126
127127 def __iter__ (self ):
128128 """
@@ -261,14 +261,19 @@ def metadata(self):
261261 )
262262 return email .message_from_string (text )
263263
264+ @property
265+ def name (self ):
266+ """Return the 'Name' metadata for the distribution package."""
267+ return self .metadata ['Name' ]
268+
264269 @property
265270 def version (self ):
266271 """Return the 'Version' metadata for the distribution package."""
267272 return self .metadata ['Version' ]
268273
269274 @property
270275 def entry_points (self ):
271- return EntryPoint ._from_text (self .read_text ('entry_points.txt' ))
276+ return EntryPoint ._from_text (self , self .read_text ('entry_points.txt' ))
272277
273278 @property
274279 def files (self ):
0 commit comments