forked from EFForg/https-everywhere
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetversion.py
More file actions
executable file
·27 lines (23 loc) · 854 Bytes
/
setversion.py
File metadata and controls
executable file
·27 lines (23 loc) · 854 Bytes
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
#!/usr/bin/env python2.7
from datetime import date
import json
import re
import sys
# Set the version in manifest.json to one based on today's date.
# Set the version in install.rdf and about.xul to one specified on the command
# line.
t = date.today()
f = open('chromium/manifest.json')
manifest = json.loads(f.read())
f.close()
manifest['version'] = `t.year` +'.'+ `t.month` +'.'+ `t.day`
f = open('chromium/manifest.json','w')
f.write(json.dumps(manifest,indent=4,sort_keys=True,separators=(',', ': ')))
def replace_in_file(from_re, to, filename):
contents = open(filename).read()
with open(filename, 'w') as outfile:
outfile.write(re.sub(from_re, to, contents))
firefox_version = sys.argv[1]
replace_in_file('<em:version>.*</em:version>',
'<em:version>' + firefox_version + '</em:version>',
'src/install.rdf')