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: 3226b12a09
("release: Add an update_release_calendar.py script")
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
update_index(is_point, version, previous_version)
|
||||
is_point = is_point_release(args.version)
|
||||
previous_version = calculate_previous_version(args.version, is_point)
|
||||
|
||||
update_index(is_point, args.version, previous_version)
|
||||
update_release_notes(previous_version)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user