"""Update the main page, release notes, and calendar."""
+import argparse
import calendar
import datetime
import pathlib
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:
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)