Skip to content

Commit

Permalink
Fix update version script
Browse files Browse the repository at this point in the history
  • Loading branch information
kratman committed Sep 3, 2024
1 parent 1ab27d1 commit bac7570
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions scripts/update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import os
import re
from datetime import date
from dateutil.relativedelta import relativedelta


import pybamm


Expand All @@ -17,11 +14,7 @@ def update_version():
Opens file and updates the version number
"""
release_version = os.getenv("VERSION")[1:]
release_date = (
date.today()
if "rc" in release_version
else date.today() + relativedelta(day=31)
)
release_date = date.today()

# pybamm/version.py
with open(
Expand Down Expand Up @@ -84,15 +77,7 @@ def update_version():
with open(os.path.join(pybamm.root_dir(), "CHANGELOG.md"), "r+") as file:
output_list = file.readlines()
output_list[0] = changelog_line1
# add a new heading for rc0 releases
if "rc0" in release_version:
output_list.insert(2, changelog_line2)
else:
# for rcX and final releases, update the already existing rc
# release heading
for i in range(0, len(output_list)):
if re.search("[v]\d\d\.\drc\d", output_list[i]):
output_list[i] = changelog_line2[:-1]
output_list.insert(2, changelog_line2)
file.truncate(0)
file.seek(0)
file.writelines(output_list)
Expand Down

0 comments on commit bac7570

Please sign in to comment.