1#!/usr/bin/env python3 2import os 3import argparse 4 5THIS_FILE_PATH = os.path.dirname(os.path.abspath(__file__)) 6MANIFEST_FILE = os.path.join(THIS_FILE_PATH, '..', '..', 'manifest.yml') 7 8def update_manifest_file(new_version_number): 9 updated_lines = [] 10 with open(MANIFEST_FILE, 'r') as f: 11 for line in f: 12 line = line.strip() 13 if line.startswith('version'): 14 updated_lines.append(f'version: "v{new_version_number}"\n') 15 else: 16 updated_lines.append(f'{line}\n') 17 18 with open(MANIFEST_FILE, 'w') as f: 19 f.writelines(updated_lines) 20 21def parse_args(): 22 parser = argparse.ArgumentParser() 23 parser.add_argument('-v', '--version', required=True, help='New version number.') 24 args = parser.parse_args() 25 return args 26 27def main(): 28 args = parse_args() 29 update_manifest_file(args.version) 30 31if __name__ == '__main__': 32 main() 33