Skip to content

Commit

Permalink
Fix python version updating script (#7213)
Browse files Browse the repository at this point in the history
Fix the python version updating script, which failed the release process
(it was bugged for not-prerelease builds).
  • Loading branch information
abey79 authored Aug 23, 2024
1 parent 699bbcf commit a071f05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions rerun_py/tests/unit/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
def test_version() -> None:
ver = semver.VersionInfo.parse(rr.__version__)

assert len(rr.__version_info__) == 4

assert ver.major == rr.__version_info__[0]
assert ver.minor == rr.__version_info__[1]
assert ver.patch == rr.__version_info__[2]
Expand All @@ -15,9 +17,7 @@ def test_version() -> None:
assert ver.prerelease == rr.__version_info__[3]
else:
# The last field is `None` if there is no prerelease.
# TODO(andreas): We released `0.18.0` `"None"` as prerelease, but really it should be `None`.
# assert rr.__version_info__[3] is None
assert len(rr.__version_info__) == 4
assert rr.__version_info__[3] is None

assert rr.__version__ in rr.version()

Expand Down
11 changes: 7 additions & 4 deletions scripts/ci/update_rerun_py_and_c_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ def update_python_line(line: str, version_line: str, version_info_line: str) ->

def set_rerun_py_version(init_path: Path, version: semver.VersionInfo) -> None:
version_line = f'__version__ = "{version}"\n'
version_info_line = (
# TODO(andreas): We released `0.18.0` `"None"` as prerelease, but really it should be `None`.
f'__version_info__ = ({version.major}, {version.minor}, {version.patch}, "{version.prerelease}")\n'
)
version_info_items = list(str(item) for item in (version.major, version.minor, version.patch))
if version.prerelease is not None:
version_info_items.append(f'"{version.prerelease}"')
else:
version_info_items.append("None")

version_info_line = f'__version_info__ = ({", ".join(version_info_items)})\n'

with init_path.open() as f:
lines = f.readlines()
Expand Down

0 comments on commit a071f05

Please sign in to comment.