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.

29 lines
869 B

  1. #!/usr/bin/env python3
  2. import os
  3. import json
  4. import sys
  5. if len(sys.argv) == 1 or not sys.argv[1]:
  6. raise SystemExit('Build dir missing.')
  7. proj_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], '..')
  8. build_dir = os.path.abspath(sys.argv[1])
  9. # Import version number from chromium platform
  10. chromium_manifest = {}
  11. webext_manifest = {}
  12. chromium_manifest_file = os.path.join(proj_dir, 'platform', 'chromium', 'manifest.json')
  13. with open(chromium_manifest_file) as f1:
  14. chromium_manifest = json.load(f1)
  15. webext_manifest_file = os.path.join(build_dir, 'manifest.json')
  16. with open(webext_manifest_file) as f2:
  17. webext_manifest = json.load(f2)
  18. webext_manifest['version'] = chromium_manifest['version']
  19. with open(webext_manifest_file, 'w') as f2:
  20. json.dump(webext_manifest, f2, indent=2, separators=(',', ': '), sort_keys=True)
  21. f2.write('\n')