Skip to content

Fix invalid assumption that version file contains just a version number #7598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion tools/automation/release/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,20 @@ def generate_news(session: Session, version: str) -> None:


def update_version_file(version: str, filepath: str) -> None:
with open(filepath, "r", encoding="utf-8") as f:
content = list(f)

file_modified = False
with open(filepath, "w", encoding="utf-8") as f:
f.write('__version__ = "{}"\n'.format(version))
for line in content:
if line.startswith("__version__ ="):
f.write('__version__ = "{}"\n'.format(version))
file_modified = True
else:
f.write(line)

assert file_modified, \
"Version file {} did not get modified".format(filepath)


def create_git_tag(session: Session, tag_name: str, *, message: str) -> None:
Expand Down