Skip to content

Commit

Permalink
Raise rather than assert
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Apr 15, 2024
1 parent 388bd17 commit 917491e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ def bump(force, skip_if_dirty, spec):
for version_file in HERE.glob("projects/**/_version.py"):
content = version_file.read_text().splitlines()
variable, current = content[0].split(" = ")
assert variable == "__version__"
if variable != "__version__":
raise ValueError(
f"Version file {version_file} has unexpected content;"
f" expected __version__ assignment in the first line, found {variable}"
)
current = current.strip("'\"")
version_spec = increment_version(current, spec)
version_file.write_text(f'__version__ = "{version_spec}"\n')
Expand Down

0 comments on commit 917491e

Please sign in to comment.