Skip to content

Commit

Permalink
Changes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Apr 15, 2021
1 parent 6845a4e commit ec86264
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions setuptools/dist.py
Expand Up @@ -106,28 +106,17 @@ def _read_list_from_msg(msg: "Message", field: str) -> Optional[List[str]]:
return values


def _read_payload_from_msg(msg: "Message") -> Optional[str]:
value = msg.get_payload().strip()
if value == 'UNKNOWN':
return None
return value


def read_pkg_file(self, file):
"""Reads the metadata values from a file object."""
msg = message_from_file(file)

def _read_long_description():
value = msg['description']
if value in ('UNKNOWN', None):
return None
description_lines = value.splitlines()
if len(description_lines) == 1:
return description_lines[0].lstrip()
description_dedent = '\n'.join(
(description_lines[0].lstrip(),
textwrap.dedent('\n'.join(description_lines[1:]))))
return description_dedent

def _read_payload():
value = msg.get_payload().strip()
if value == 'UNKNOWN':
return None
return value

self.metadata_version = StrictVersion(msg['metadata-version'])
self.name = _read_field_from_msg(msg, 'name')
self.version = _read_field_from_msg(msg, 'version')
Expand All @@ -147,7 +136,7 @@ def _read_payload():

self.long_description = _read_field_unescaped_from_msg(msg, 'description')
if self.long_description is None and self.metadata_version >= StrictVersion('2.1'):
self.long_description = _read_payload()
self.long_description = _read_payload_from_msg(msg)
self.description = _read_field_from_msg(msg, 'summary')

if 'keywords' in msg:
Expand Down

0 comments on commit ec86264

Please sign in to comment.