Skip to content

Ignore newlines when processing keywords/platforms #4888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/4887.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed handling of keywords following the old specification with spaces instead of commas and containing newlines.
1 change: 1 addition & 0 deletions setuptools/_distutils/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ def finalize_options(self) -> None:
if value is None:
continue
if isinstance(value, str):
value = value.replace("\n", " ")
value = [elm.strip() for elm in value.split(',')]
setattr(self.metadata, attr, value)

Expand Down
24 changes: 24 additions & 0 deletions setuptools/tests/test_core_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,30 @@ def __read_test_cases():
version=sic('1.0.0a'),
),
),
(
'Keywords with commas',
params(
keywords='one, two, three',
),
),
(
'Keywords with spaces',
params(
keywords='one two three',
),
),
(
'Keywords with commas multiline',
params(
keywords='one, two,\nthree, four\n',
),
),
(
'Keywords with spaces multiline',
params(
keywords='one two\nthree four\n',
),
),
]


Expand Down
Loading