You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.0 KiB

  1. #!/usr/bin/env python3
  2. import os
  3. import json
  4. import re
  5. import sys
  6. if len(sys.argv) == 1 or not sys.argv[1]:
  7. raise SystemExit('Build dir missing.')
  8. proj_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], '..')
  9. manifest_in = {}
  10. manifest_in_file = os.path.join(proj_dir, 'platform', 'chromium', 'manifest.json')
  11. with open(manifest_in_file) as f1:
  12. manifest_in = json.load(f1)
  13. # Development build? If so, modify name accordingly.
  14. match = re.search('^\d+\.\d+\.\d+\.\d+$', manifest_in['version'])
  15. if match:
  16. build_dir = os.path.abspath(sys.argv[1])
  17. dev_build = ' dev build'
  18. manifest_out = {}
  19. manifest_out_file = os.path.join(build_dir, 'manifest.json')
  20. with open(manifest_out_file) as f2:
  21. manifest_out = json.load(f2)
  22. manifest_out['name'] += dev_build
  23. manifest_out['short_name'] += dev_build
  24. manifest_out['browser_action']['default_title'] += dev_build
  25. with open(manifest_out_file, 'w') as f2:
  26. json.dump(manifest_out, f2, indent=2, separators=(',', ': '), sort_keys=True)
  27. f2.write('\n')