From 24d52c59097ba18f1534a7025b0d3171017ddfbc Mon Sep 17 00:00:00 2001 From: link2xt Date: Tue, 16 May 2023 22:47:28 +0000 Subject: [PATCH] build(set_core_version.py): expect release date in the changelog git-cliff adds the date to the changelog automatically, so set_core_version.py only needs to check that the date is in place. --- scripts/set_core_version.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/scripts/set_core_version.py b/scripts/set_core_version.py index afb113903..0958c1669 100755 --- a/scripts/set_core_version.py +++ b/scripts/set_core_version.py @@ -7,6 +7,7 @@ import pathlib import re import subprocess from argparse import ArgumentParser +from pathlib import Path rex = re.compile(r'version = "(\S+)"') @@ -95,22 +96,14 @@ def main(): today = datetime.date.today().isoformat() if "alpha" not in newversion: - changelog_name = "CHANGELOG.md" - changelog_tmpname = changelog_name + ".tmp" - changelog_tmp = open(changelog_tmpname, "w") found = False - for line in open(changelog_name): - ## 1.25.0 - if line == f"## [{newversion}]\n": - line = f"## [{newversion}] - {today}\n" + for line in Path("CHANGELOG.md").open(): + if line == f"## [{newversion}] - {today}\n": found = True - changelog_tmp.write(line) if not found: raise SystemExit( f"{changelog_name} contains no entry for version: {newversion}" ) - changelog_tmp.close() - os.rename(changelog_tmpname, changelog_name) for toml_filename in toml_list: replace_toml_version(toml_filename, newversion)