Commit d01d3ee2 authored by Jason R. Coombs's avatar Jason R. Coombs

Quick fix for #1390. Now description cannot contain a newline.

parent b994bc63
Newlines in metadata description/Summary now trigger a ValueError.
......@@ -118,6 +118,13 @@ def read_pkg_file(self, file):
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): # noqa: C901 # is too complex (14) # FIXME
"""Write the PKG-INFO format data to a file object.
......@@ -130,7 +137,7 @@ def write_pkg_file(self, file): # noqa: C901 # is too complex (14) # FIXME
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'):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment