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.

34 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. webext_manifest = {}
  14. webext_manifest_file = os.path.join(build_dir, 'manifest.json')
  15. with open(webext_manifest_file) as f:
  16. webext_manifest = json.load(f)
  17. webext_manifest['version'] = version
  18. match = re.search('^\d+\.\d+\.\d+(b|rc)', version)
  19. if not match:
  20. # https://bugzilla.mozilla.org/show_bug.cgi?id=1459007
  21. # By design Firefox opens the sidebar with new installation of
  22. # uMatrix when sidebar_action is present in the manifest.
  23. # Remove sidebarAction support for stable release of uBO.
  24. del webext_manifest['sidebar_action']
  25. with open(webext_manifest_file, 'w') as f2:
  26. json.dump(webext_manifest, f2, indent=2, separators=(',', ': '), sort_keys=True)
  27. f2.write('\n')