diff options
| author | Sviatoslav Sydorenko <wk@sydorenko.org.ua> | 2021-11-11 03:43:03 +0100 |
|---|---|---|
| committer | Sviatoslav Sydorenko <wk@sydorenko.org.ua> | 2021-11-11 03:43:03 +0100 |
| commit | f8fe4a873c5d3d89a939c0576e1c14a8e82c73c8 (patch) | |
| tree | b6bf8b98bb1bb91a3343d885e488016d31132bb0 | |
| parent | 07651438d6b2086453b7f298feabb6911e5aa230 (diff) | |
| download | python-setuptools-git-f8fe4a873c5d3d89a939c0576e1c14a8e82c73c8.tar.gz | |
Fail on a multiline distribution package summary
| -rw-r--r-- | setuptools/dist.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/setuptools/dist.py b/setuptools/dist.py index 8e2111a5..e61733d8 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -144,12 +144,14 @@ def read_pkg_file(self, file): self.license_files = _read_list_from_msg(msg, 'license-file') -def single_line(val): - # quick and dirty validation for description pypa/setuptools#1390 +def ensure_summary_single_line(val): + """Validate that the summary does not have line breaks.""" + # Ref: https://github.com/pypa/setuptools/issues/1390 if '\n' in val: - # TODO after 2021-07-31: Replace with `raise ValueError("newlines not allowed")` - warnings.warn("newlines not allowed and will break in the future") - val = val.replace('\n', ' ') + raise ValueError( + 'Newlines in the package distribution summary are not allowed', + ) + return val @@ -164,7 +166,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', single_line(self.get_description())) + write_field('Summary', ensure_summary_single_line(self.get_description())) write_field('Home-page', self.get_url()) optional_fields = ( |
