From e2a632576cd79a6d38a3f6f9f9ac348642e35230 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Thu, 3 Feb 2022 15:00:09 +0000 Subject: Modify tools.finalize.check_changes to validate extensions The previous existing implementation would just check for the existence of a preconfigured substring (e.g. `changes`, `doc`, ...). However that can be problematic when the used extension contains one of the valid substrings but is not valid itself. For example `changelog.d/3034.docs.rst` contains the valid `doc` substring but is not a valid name itself. The correct would be `changelog.d/3034.doc.rst`. --- tools/finalize.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tools/finalize.py') diff --git a/tools/finalize.py b/tools/finalize.py index 516a2fb5..e4f65543 100644 --- a/tools/finalize.py +++ b/tools/finalize.py @@ -79,11 +79,18 @@ def check_changes(): """ allowed = 'deprecation', 'breaking', 'change', 'doc', 'misc' except_ = 'README.rst', '.gitignore' - assert all( - any(key in file.name for key in allowed) + news_fragments = ( + file for file in pathlib.Path('changelog.d').iterdir() if file.name not in except_ ) + unrecognized = [ + str(file) + for file in news_fragments + if not any(f".{key}" in file.suffixes for key in allowed) + ] + if unrecognized: + raise ValueError(f"Some news fragments have invalid names: {unrecognized}") if __name__ == '__main__': -- cgit v1.2.1 From 5a0fbfb860b8c380c9a84c0bd977dbba2ed1825c Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Wed, 16 Mar 2022 14:55:58 +0000 Subject: Fix towncrier command in tools/finalize --- tools/finalize.py | 1 + 1 file changed, 1 insertion(+) (limited to 'tools/finalize.py') diff --git a/tools/finalize.py b/tools/finalize.py index e4f65543..5a4df5df 100644 --- a/tools/finalize.py +++ b/tools/finalize.py @@ -42,6 +42,7 @@ def update_changelog(): cmd = [ sys.executable, '-m', 'towncrier', + 'build', '--version', get_version(), '--yes', ] -- cgit v1.2.1