Skip to content

Commit 24d52c5

Browse files
committed
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.
1 parent f9dc8ed commit 24d52c5

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

scripts/set_core_version.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import re
88
import subprocess
99
from argparse import ArgumentParser
10+
from pathlib import Path
1011

1112
rex = re.compile(r'version = "(\S+)"')
1213

@@ -95,22 +96,14 @@ def main():
9596
today = datetime.date.today().isoformat()
9697

9798
if "alpha" not in newversion:
98-
changelog_name = "CHANGELOG.md"
99-
changelog_tmpname = changelog_name + ".tmp"
100-
changelog_tmp = open(changelog_tmpname, "w")
10199
found = False
102-
for line in open(changelog_name):
103-
## 1.25.0
104-
if line == f"## [{newversion}]\n":
105-
line = f"## [{newversion}] - {today}\n"
100+
for line in Path("CHANGELOG.md").open():
101+
if line == f"## [{newversion}] - {today}\n":
106102
found = True
107-
changelog_tmp.write(line)
108103
if not found:
109104
raise SystemExit(
110105
f"{changelog_name} contains no entry for version: {newversion}"
111106
)
112-
changelog_tmp.close()
113-
os.rename(changelog_tmpname, changelog_name)
114107

115108
for toml_filename in toml_list:
116109
replace_toml_version(toml_filename, newversion)

0 commit comments

Comments
 (0)