diff options
author | Dylan Baker <[email protected]> | 2019-10-09 10:31:16 -0700 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2019-10-25 15:46:06 -0700 |
commit | abf9e7ac7bdb26ef203394ccdd5f0a43ceda1493 (patch) | |
tree | 601545d2962dff630af73b4b9030a04265c66dd5 /bin/post_version.py | |
parent | c6d41e7f0b0c998d9b6f4b1ff55eab9f6cd12ef4 (diff) |
bin/post_version.py: Pass version as an argument
I made a bad assumption; I assumed this would be run in the release
branch. But we don't do that, we run in the master branch. As a result
we need to pass the version as an argument.
Fixes: 3226b12a09bbcbd25526fd6da6257057d26ddb31
("release: Add an update_release_calendar.py script")
Reviewed-by: Eric Engestrom <[email protected]>
Reviewed-by: Juan A. Suarez <[email protected]>
Diffstat (limited to 'bin/post_version.py')
-rwxr-xr-x | bin/post_version.py | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/bin/post_version.py b/bin/post_version.py index 9afb37b18a3..2d195dce1b3 100755 --- a/bin/post_version.py +++ b/bin/post_version.py @@ -21,6 +21,7 @@ """Update the main page, release notes, and calendar.""" +import argparse import calendar import datetime import pathlib @@ -51,18 +52,8 @@ def calculate_previous_version(version: str, is_point: bool) -> str: return '.'.join(base) -def get_version() -> str: - v = pathlib.Path(__file__).parent.parent / 'VERSION' - with v.open('rt') as f: - raw_version = f.read().strip() - return raw_version.split('-')[0] - - -def is_point_release() -> bool: - v = pathlib.Path(__file__).parent.parent / 'VERSION' - with v.open('rt') as f: - raw_version = f.read().strip() - return '-rc' not in raw_version +def is_point_release(version: str) -> bool: + return not version.endswith('.0') def update_index(is_point: bool, version: str, previous_version: str) -> None: @@ -110,11 +101,14 @@ def update_release_notes(previous_version: str) -> None: def main() -> None: - is_point = is_point_release() - version = get_version() - previous_version = calculate_previous_version(version, is_point) + parser = argparse.ArgumentParser() + parser.add_argument('version', help="The released version.") + args = parser.parse_args() + + is_point = is_point_release(args.version) + previous_version = calculate_previous_version(args.version, is_point) - update_index(is_point, version, previous_version) + update_index(is_point, args.version, previous_version) update_release_notes(previous_version) |