From e58590936f3a4c89d3569fd693690a0cda5f99aa Mon Sep 17 00:00:00 2001 From: Hans Dembinski Date: Sat, 16 Jul 2022 12:15:45 +0200 Subject: [PATCH] update changelog --- .github/workflows/{wheels.yml => release.yml} | 2 +- doc/changelog.rst | 4 ++ doc/update_changelog.py | 43 +++++++++++-------- 3 files changed, 31 insertions(+), 18 deletions(-) rename .github/workflows/{wheels.yml => release.yml} (99%) diff --git a/.github/workflows/wheels.yml b/.github/workflows/release.yml similarity index 99% rename from .github/workflows/wheels.yml rename to .github/workflows/release.yml index 9e445ff54..b93c12633 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Wheels +name: Release on: push: diff --git a/doc/changelog.rst b/doc/changelog.rst index ede9491ab..6424e02f8 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -5,6 +5,10 @@ Changelog ========= +2.12.3b1 (July 16, 2022) +------------------------ +- Minor improvements + 2.12.2 (July 15, 2022) ---------------------- - fix a bug in error heuristic when parameters have negative values and prevent assigning negative values to errors (#759) diff --git a/doc/update_changelog.py b/doc/update_changelog.py index 638cb6566..35ec1d8ab 100644 --- a/doc/update_changelog.py +++ b/doc/update_changelog.py @@ -3,6 +3,7 @@ import subprocess as subp from pkg_resources import parse_version import datetime +import warnings cwd = Path(__file__).parent @@ -11,17 +12,22 @@ exec(f.read(), version) new_version = parse_version(version["version"]) -latest_tag = next( - iter( - sorted( - ( - parse_version(x) - for x in subp.check_output(["git", "tag"]).decode().strip().split("\n") - ), - reverse=True, +with warnings.catch_warnings(): + warnings.simplefilter("ignore") + latest_tag = next( + iter( + sorted( + ( + parse_version(x) + for x in subp.check_output(["git", "tag"]) + .decode() + .strip() + .split("\n") + ), + reverse=True, + ) ) ) -) with open(cwd / "changelog.rst") as f: content = f.read() @@ -44,13 +50,16 @@ today = datetime.date.today() header = f"{new_version} ({today.strftime('%B %d, %Y')})" -content2 = f"""{content[:position]}{header} -{'-' * len(header)} -""" -for x in git_log: - content2 += f"- {x}\n" -content2 += "\n" -content2 += content[position:] + +new_content = f"{header}\n{'-' * len(header)}\n" +if git_log: + for x in git_log: + new_content += f"- {x}\n" +else: + new_content += "- Minor improvements\n" +new_content += "\n" + +print(new_content, end="") with open(cwd / "changelog.rst", "w") as f: - f.write(content2) + f.write(f"{content[:position]}{new_content}{content[position:]}")