Skip to content

Commit

Permalink
Quick fix for #1390. Now description cannot contain a newline.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Dec 6, 2020
1 parent 5cf3865 commit 904f4a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/1390.change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Newlines in metadata description/Summary now trigger a ValueError.
9 changes: 8 additions & 1 deletion setuptools/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ def _read_list(name):
self.obsoletes = None


def single_line(val):
# quick and dirty validation for description pypa/setuptools#1390
if '\n' in val:
raise ValueError("newlines not allowed")
return val


# Based on Python 3.5 version
def write_pkg_file(self, file):
"""Write the PKG-INFO format data to a file object.
Expand All @@ -130,7 +137,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', self.get_description())
write_field('Summary', single_line(self.get_description()))
write_field('Home-page', self.get_url())

if version < StrictVersion('1.2'):
Expand Down

0 comments on commit 904f4a1

Please sign in to comment.