aboutsummaryrefslogtreecommitdiff
path: root/devscripts/update_changelog.py
diff options
context:
space:
mode:
authorbashonly <88596187+bashonly@users.noreply.github.com>2024-03-14 16:10:20 -0500
committerGitHub <noreply@github.com>2024-03-14 21:10:20 +0000
commit17b96974a334688f76b57d350e07cae8cda46877 (patch)
tree9347b7f7dc152e4a650615ae021e580578c9747b /devscripts/update_changelog.py
parent8463fb510a58050ec118b3ae17bf00d08ea7b881 (diff)
[build] Update changelog for tarball and sdist (#9425)
Closes #9417 Authored by: bashonly
Diffstat (limited to 'devscripts/update_changelog.py')
-rwxr-xr-xdevscripts/update_changelog.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/devscripts/update_changelog.py b/devscripts/update_changelog.py
new file mode 100755
index 000000000..36b9a8e86
--- /dev/null
+++ b/devscripts/update_changelog.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+
+# Allow direct execution
+import os
+import sys
+
+sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+from pathlib import Path
+
+from devscripts.make_changelog import create_changelog, create_parser
+from devscripts.utils import read_file, read_version, write_file
+
+# Always run after devscripts/update-version.py, and run before `make doc|pypi-files|tar|all`
+
+if __name__ == '__main__':
+ parser = create_parser()
+ parser.description = 'Update an existing changelog file with an entry for a new release'
+ parser.add_argument(
+ '--changelog-path', type=Path, default=Path(__file__).parent.parent / 'Changelog.md',
+ help='path to the Changelog file')
+ args = parser.parse_args()
+ new_entry = create_changelog(args)
+
+ header, sep, changelog = read_file(args.changelog_path).partition('\n### ')
+ write_file(args.changelog_path, f'{header}{sep}{read_version()}\n{new_entry}\n{sep}{changelog}')