Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: packagerChrome.py

Issue 29365583: Issue 4670 - Add a new build type for Gecko-based WebExtensions (Closed) Base URL: https://hg.adblockplus.org/buildtools
Left Patch Set: Addressed comments Created Dec. 1, 2016, 9:38 p.m.
Right Patch Set: Split out info module into a Chrome and Gecko specific one Created Dec. 3, 2016, 7:02 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « build.py ('k') | templates/geckoInfo.js.tmpl » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # This Source Code Form is subject to the terms of the Mozilla Public 1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this 2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 4
5 import errno 5 import errno
6 import io 6 import io
7 import json 7 import json
8 import os 8 import os
9 import re 9 import re
10 from StringIO import StringIO 10 from StringIO import StringIO
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 licenseComment = re.compile(r'/\*.*?\*/', re.S) 132 licenseComment = re.compile(r'/\*.*?\*/', re.S)
133 data = json.loads(re.sub(licenseComment, '', manifest, 1)) 133 data = json.loads(re.sub(licenseComment, '', manifest, 1))
134 if '_dummy' in data: 134 if '_dummy' in data:
135 del data['_dummy'] 135 del data['_dummy']
136 manifest = json.dumps(data, sort_keys=True, indent=2) 136 manifest = json.dumps(data, sort_keys=True, indent=2)
137 137
138 return manifest.encode('utf-8') 138 return manifest.encode('utf-8')
139 139
140 140
141 def createInfoModule(params): 141 def createInfoModule(params):
142 template = getTemplate('chromeInfo.js.tmpl') 142 if params['type'] == 'gecko-webext':
143 template = getTemplate('geckoInfo.js.tmpl')
144 else:
145 template = getTemplate('chromeInfo.js.tmpl')
143 return template.render(params).encode('utf-8') 146 return template.render(params).encode('utf-8')
144 147
145 148
146 def convertJS(params, files): 149 def convertJS(params, files):
147 from jshydra.abp_rewrite import rewrite_js 150 from jshydra.abp_rewrite import rewrite_js
148 151
149 output_files = collections.OrderedDict() 152 output_files = collections.OrderedDict()
150 args = collections.defaultdict(list) 153 args = collections.defaultdict(list)
151 154
152 for item in params['metadata'].items('convert_js'): 155 for item in params['metadata'].items('convert_js'):
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmp l', 391 files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmp l',
389 ('general', 'testScripts')) 392 ('general', 'testScripts'))
390 393
391 zipdata = files.zipToString() 394 zipdata = files.zipToString()
392 signature = None 395 signature = None
393 pubkey = None 396 pubkey = None
394 if keyFile != None: 397 if keyFile != None:
395 signature = signBinary(zipdata, keyFile) 398 signature = signBinary(zipdata, keyFile)
396 pubkey = getPublicKey(keyFile) 399 pubkey = getPublicKey(keyFile)
397 writePackage(outFile, pubkey, signature, zipdata) 400 writePackage(outFile, pubkey, signature, zipdata)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld