Skip to content

Commit

Permalink
Restore single_line as a simple, universal validator.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Nov 13, 2021
1 parent 65d6653 commit a4b7cae
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions setuptools/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,11 @@ def read_pkg_file(self, file):
self.license_files = _read_list_from_msg(msg, 'license-file')


def ensure_summary_single_line(val):
"""Validate that the summary does not have line breaks."""
def single_line(val):
"""Validate that the value does not have line breaks."""
# Ref: https://github.com/pypa/setuptools/issues/1390
if '\n' in val:
raise ValueError(
'Newlines in the package distribution summary are not allowed',
)
raise ValueError('Newlines are not allowed')

return val

Expand All @@ -166,7 +164,7 @@ def write_field(key, value):
write_field('Metadata-Version', str(version))
write_field('Name', self.get_name())
write_field('Version', self.get_version())
write_field('Summary', ensure_summary_single_line(self.get_description()))
write_field('Summary', single_line(self.get_description()))
write_field('Home-page', self.get_url())

optional_fields = (
Expand Down

0 comments on commit a4b7cae

Please sign in to comment.