Skip to content

Commit

Permalink
Update the release script
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Dec 30, 2023
1 parent 55190da commit 3324152
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions support/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,17 @@ def release(args):
if not fmt_repo.update('-b', branch, fmt_repo_url):
clean_checkout(fmt_repo, branch)

# Convert changelog from RST to GitHub-flavored Markdown and get the
# version.
# Update the date in the changelog.
changelog = 'ChangeLog.md'
changelog_path = os.path.join(fmt_repo.dir, changelog)
import rst2md
changes, version = rst2md.convert(changelog_path)
title_len = 0
for line in fileinput.input(changelog_path, inplace=True):
m = re.match(r'# (.*) - TBD', line)
if m:
version = m.group(1)
line = version + ' - ' + datetime.date.today().isoformat() + '\n'
sys.stdout.write(line)

cmakelists = 'CMakeLists.txt'
for line in fileinput.input(os.path.join(fmt_repo.dir, cmakelists),
inplace=True):
Expand All @@ -243,18 +248,6 @@ def release(args):
line = prefix + version + ')\n'
sys.stdout.write(line)

# Update the version in the changelog.
title_len = 0
for line in fileinput.input(changelog_path, inplace=True):
if line.startswith(version + ' - TBD'):
line = version + ' - ' + datetime.date.today().isoformat()
title_len = len(line)
line += '\n'
elif title_len:
line = '-' * title_len + '\n'
title_len = 0
sys.stdout.write(line)

# Add the version to the build script.
script = os.path.join('doc', 'build.py')
script_path = os.path.join(fmt_repo.dir, script)
Expand Down

0 comments on commit 3324152

Please sign in to comment.