You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
918 B
Python
33 lines
918 B
Python
#!/usr/bin/env python3
|
|
import os
|
|
import argparse
|
|
|
|
THIS_FILE_PATH = os.path.dirname(os.path.abspath(__file__))
|
|
MANIFEST_FILE = os.path.join(THIS_FILE_PATH, '..', '..', 'manifest.yml')
|
|
|
|
def update_manifest_file(new_version_number):
|
|
updated_lines = []
|
|
with open(MANIFEST_FILE, 'r') as f:
|
|
for line in f:
|
|
line = line.strip()
|
|
if line.startswith('version'):
|
|
updated_lines.append(f'version: "v{new_version_number}"\n')
|
|
else:
|
|
updated_lines.append(f'{line}\n')
|
|
|
|
with open(MANIFEST_FILE, 'w') as f:
|
|
f.writelines(updated_lines)
|
|
|
|
def parse_args():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('-v', '--version', required=True, help='New version number.')
|
|
args = parser.parse_args()
|
|
return args
|
|
|
|
def main():
|
|
args = parse_args()
|
|
update_manifest_file(args.version)
|
|
|
|
if __name__ == '__main__':
|
|
main()
|