diff options
| author | wim glenn <hey@wimglenn.com> | 2022-04-29 22:34:27 -0500 |
|---|---|---|
| committer | wim glenn <hey@wimglenn.com> | 2022-04-29 22:34:27 -0500 |
| commit | 1cfa27c05bd6753c7a7c5fa4cb498c85ce088392 (patch) | |
| tree | bc7248e3ffa0c8a622f55959065e71dd3076ee36 /setuptools/tests/config | |
| parent | ddb8844eac49e0bf3b4f20067b425ffeac1531a2 (diff) | |
| download | python-setuptools-git-1cfa27c05bd6753c7a7c5fa4cb498c85ce088392.tar.gz | |
do not backfill Project-URL: homepage into Home-page: field (causes duplicates on PyPI). prevent "UNKNOWN" vals from appearing in summary, license, platform. prevent an extra newline getting added in long description
Diffstat (limited to 'setuptools/tests/config')
| -rw-r--r-- | setuptools/tests/config/test_apply_pyprojecttoml.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/setuptools/tests/config/test_apply_pyprojecttoml.py b/setuptools/tests/config/test_apply_pyprojecttoml.py index 045d7f40..4f541697 100644 --- a/setuptools/tests/config/test_apply_pyprojecttoml.py +++ b/setuptools/tests/config/test_apply_pyprojecttoml.py @@ -298,19 +298,26 @@ class TestMeta: def core_metadata(dist) -> str: with io.StringIO() as buffer: dist.metadata.write_pkg_file(buffer) - value = "\n".join(buffer.getvalue().strip().splitlines()) + pkg_file_txt = buffer.getvalue() + skip_prefixes = () + skip_lines = set() # ---- DIFF NORMALISATION ---- # PEP 621 is very particular about author/maintainer metadata conversion, so skip - value = re.sub(r"^(Author|Maintainer)(-email)?:.*$", "", value, flags=re.M) + skip_prefixes += ("Author:", "Author-email:", "Maintainer:", "Maintainer-email:") # May be redundant with Home-page - value = re.sub(r"^Project-URL: Homepage,.*$", "", value, flags=re.M) + skip_prefixes += ("Project-URL: Homepage,", "Home-page:") # May be missing in original (relying on default) but backfilled in the TOML - value = re.sub(r"^Description-Content-Type:.*$", "", value, flags=re.M) + skip_prefixes += ("Description-Content-Type:",) # ini2toml can automatically convert `tests_require` to `testing` extra - value = value.replace("Provides-Extra: testing\n", "") + skip_lines.add("Provides-Extra: testing") # Remove empty lines - value = re.sub(r"^\s*$", "", value, flags=re.M) - value = re.sub(r"^\n", "", value, flags=re.M) + skip_lines.add("") - return value + result = [] + for line in pkg_file_txt.splitlines(): + if line.startswith(skip_prefixes) or line in skip_lines: + continue + result.append(line + "\n") + + return "".join(result) |
