Update implementation based on importlib_metadata 0.10

This commit is contained in:
Jason R. Coombs 2019-05-08 10:02:31 -04:00
parent a1d873b7d6
commit 6d7e3a8592
6 changed files with 113 additions and 170 deletions

View file

@ -179,7 +179,14 @@ class Distribution:
The returned object will have keys that name the various bits of
metadata. See PEP 566 for details.
"""
text = self.read_text('METADATA') or self.read_text('PKG-INFO')
text = (
self.read_text('METADATA')
or self.read_text('PKG-INFO')
# This last clause is here to support old egg-info files. Its
# effect is to just end up using the PathDistribution's self._path
# (which points to the egg-info file) attribute unchanged.
or self.read_text('')
)
return email.message_from_string(text)
@property
@ -230,7 +237,7 @@ class Distribution:
def _read_egg_info_reqs(self):
source = self.read_text('requires.txt')
return self._deps_from_requires_text(source)
return source and self._deps_from_requires_text(source)
@classmethod
def _deps_from_requires_text(cls, source):