-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish
executable file
·43 lines (41 loc) · 1.96 KB
/
publish
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python
from glob import glob
from datetime import datetime
import subprocess, os, json, re, sys
# from pprint import pprint
def load_manifest(path):
with open(path+"/manifest.json.template") as manifestJSON:
output = json.loads(re.sub("\s//.*", "", manifestJSON.read(), flags=re.MULTILINE)) # To read JSON with comments
return output
def update_updaters():
path = os.getcwd()
if os.path.isdir('source'):
print("Reading '"+path+"'...")
manifest = load_manifest(path)
manifest['version'] = datetime.now().strftime("%Y.%-m.%-d.")+manifest['version']
# Build Firefox's version
print("Building...")
# if len(sys.argv)>1 and sys.argv[1] == "-t":
# print("~~~TESTING VERSION~~~")
# manifest['name'] = "Front End Framework Beta"
# manifest['applications']['gecko']['id'] = '[email protected]'
with open(path+'/source/manifest.json','w') as firefox:
json.dump(manifest, firefox, indent=4)
print("web-ext","build","-s="+path+"/source","-a="+path+"/builds/firefox","--overwrite-dest","-i",".*")
p = subprocess.Popen([ # Build the new firefox version
"web-ext","build","-s="+path+"/source","-a="+path+"/builds/firefox","--overwrite-dest","-i",".*"
], stdout=open("/dev/null", "w") )
os.waitpid(p.pid, 0)
# Build chrome's version
# manifest.pop('applications', None)
# manifest['icons'] = { "128": "Public/Icons/favicon.png" }
# manifest['browser_action']['default_icon'] = { "128": "Public/Icons/favicon.png" }
# manifest['browser_action'].pop('browser_style', None)
# manifest['options_ui'].pop('browser_style', None)
# with open(path+'/source/manifest.json','w') as chrome:
# json.dump(manifest, chrome, indent=4)
# print("web-ext","build","-s="+path+"/source","-a="+path+"/builds/chrome","--overwrite-dest","-i",".*")
# q = subprocess.Popen([ # Build the new chrome version
# "web-ext","build","-s="+path+"/source","-a="+path+"/builds/chrome","--overwrite-dest","-i",".*"
# ], stdout=open("/dev/null", "w") )
update_updaters()