1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
hipchat-emoticons-for-all/chrome/build-manifest.py

42 lines
996 B
Python
Raw Normal View History

2015-08-20 11:51:20 +01:00
import json
2015-08-20 19:28:20 +01:00
import os
current_dir = os.path.dirname(os.path.realpath(__file__)) + "/"
2015-08-20 11:51:20 +01:00
2015-08-20 19:28:20 +01:00
with open(current_dir + "../package.json") as json_file:
2015-08-20 11:51:20 +01:00
project_package = json.load(json_file)
2015-08-20 19:28:20 +01:00
with open(current_dir + "manifest.json") as json_file:
2015-08-20 11:51:20 +01:00
manifest = json.load(json_file)
switcher = {
'name': 'name',
'version': 'version',
'description': 'description',
}
2015-08-20 19:28:20 +01:00
for key, value in switcher.items():
2015-08-20 11:51:20 +01:00
manifest[value] = project_package[key]
2015-08-24 14:57:19 +01:00
with open(current_dir + "data/decoder.json") as json_file:
2015-08-20 19:28:20 +01:00
site_decoder = json.load(json_file)['sites']
2015-08-20 11:51:20 +01:00
content_scripts = []
2015-08-20 19:28:20 +01:00
for site in site_decoder:
site = list(site.items())[0]
2015-08-20 11:51:20 +01:00
temp = {}
2015-08-24 14:57:19 +01:00
temp['matches'] = ["*://" + site[0] + '/*']
temp['js'] = ['data/lib/jquery.js', 'data/injector.js', 'data/injections/' + site[1]]
2015-08-20 11:51:20 +01:00
content_scripts.append(temp)
manifest['content_scripts'] = content_scripts
2015-08-20 19:28:20 +01:00
with open(current_dir + 'manifest.json', 'w') as file:
json.dump(manifest, file, indent=2, sort_keys=True)