Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 Loading... | |
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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 file.write(signature) | 332 file.write(signature) |
330 file.write(zipdata) | 333 file.write(zipdata) |
331 | 334 |
332 | 335 |
333 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil d=False, keyFile=None, devenv=False): | 336 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil d=False, keyFile=None, devenv=False): |
334 metadata = readMetadata(baseDir, type) | 337 metadata = readMetadata(baseDir, type) |
335 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) | 338 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) |
336 | 339 |
337 if outFile == None: | 340 if outFile == None: |
338 if type == 'gecko-webext': | 341 if type == 'gecko-webext': |
339 file_extension = 'xpi' | 342 file_extension = 'xpi' |
Sebastian Noack
2016/12/01 16:24:54
So do I understand correctly, that WebExtensions f
Wladimir Palant
2016/12/01 21:39:31
Yes, there is only a difference for signed package
| |
340 else: | 343 else: |
341 file_extension = 'crx' if keyFile else 'zip' | 344 file_extension = 'crx' if keyFile else 'zip' |
342 outFile = getDefaultFileName(metadata, version, file_extension) | 345 outFile = getDefaultFileName(metadata, version, file_extension) |
343 | 346 |
344 params = { | 347 params = { |
345 'type': type, | 348 'type': type, |
346 'baseDir': baseDir, | 349 'baseDir': baseDir, |
347 'releaseBuild': releaseBuild, | 350 'releaseBuild': releaseBuild, |
348 'version': version, | 351 'version': version, |
349 'devenv': devenv, | 352 'devenv': devenv, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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) |
LEFT | RIGHT |