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.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. build_dir = os.path.abspath(sys.argv[1])
  10. # Import data from chromium platform
  11. chromium_manifest = {}
  12. opera_manifest = {}
  13. chromium_manifest_file = os.path.join(proj_dir, 'platform', 'chromium', 'manifest.json')
  14. with open(chromium_manifest_file) as f1:
  15. chromium_manifest = json.load(f1)
  16. # WebExtension
  17. opera_manifest_add_file = os.path.join(proj_dir, 'platform', 'opera', 'manifest-add.json')
  18. with open(opera_manifest_add_file) as f2:
  19. opera_manifest = json.load(f2)
  20. for key in chromium_manifest:
  21. if key not in opera_manifest:
  22. opera_manifest[key] = chromium_manifest[key]
  23. opera_manifest_file = os.path.join(build_dir, 'manifest.json')
  24. with open(opera_manifest_file, 'w') as f2:
  25. json.dump(opera_manifest, f2, indent=2, separators=(',', ': '), sort_keys=True)
  26. f2.write('\n')