diff --git a/newsfragments/4887.bugfix.rst b/newsfragments/4887.bugfix.rst new file mode 100644 index 0000000000..83b92562c6 --- /dev/null +++ b/newsfragments/4887.bugfix.rst @@ -0,0 +1 @@ +Fixed handling of keywords following the old specification with spaces instead of commas and containing newlines. \ No newline at end of file diff --git a/setuptools/_distutils/dist.py b/setuptools/_distutils/dist.py index 69d42016a1..8752e203e0 100644 --- a/setuptools/_distutils/dist.py +++ b/setuptools/_distutils/dist.py @@ -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) diff --git a/setuptools/tests/test_core_metadata.py b/setuptools/tests/test_core_metadata.py index b1edb79b40..30aa313f58 100644 --- a/setuptools/tests/test_core_metadata.py +++ b/setuptools/tests/test_core_metadata.py @@ -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', + ), + ), ]