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.

39 lines
1.1 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. build_dir = os.path.abspath(sys.argv[1])
  10. version = ''
  11. with open(os.path.join(proj_dir, 'dist', 'version')) as f:
  12. version = f.read().strip()
  13. manifest_out = {}
  14. manifest_out_file = os.path.join(build_dir, 'manifest.json')
  15. with open(manifest_out_file) as f:
  16. manifest_out = json.load(f)
  17. # Development build? If so, modify name accordingly.
  18. match = re.search('^(\d+\.\d+\.\d+)(\.|b|rc)(\d+)$', version)
  19. if match:
  20. version = match.group(1)
  21. revision = int(match.group(3))
  22. if match.group(2) == 'rc':
  23. revision += 100
  24. version += '.' + str(revision)
  25. manifest_out['name'] += ' development build'
  26. manifest_out['short_name'] += ' dev build'
  27. manifest_out['browser_action']['default_title'] += ' dev build'
  28. manifest_out['version'] = version
  29. with open(manifest_out_file, 'w') as f:
  30. json.dump(manifest_out, f, indent=2, separators=(',', ': '), sort_keys=True)
  31. f.write('\n')