OLD | NEW |
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 glob | 6 import glob |
7 import io | 7 import io |
8 import json | 8 import json |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 data, ensure_ascii=False, sort_keys=True, | 145 data, ensure_ascii=False, sort_keys=True, |
146 indent=2, separators=(',', ': ') | 146 indent=2, separators=(',', ': ') |
147 ).encode('utf-8') + '\n' | 147 ).encode('utf-8') + '\n' |
148 | 148 |
149 | 149 |
150 def create_bundles(params, files): | 150 def create_bundles(params, files): |
151 base_extension_path = params['baseDir'] | 151 base_extension_path = params['baseDir'] |
152 info_templates = { | 152 info_templates = { |
153 'chrome': 'chromeInfo.js.tmpl', | 153 'chrome': 'chromeInfo.js.tmpl', |
154 'edge': 'edgeInfo.js.tmpl', | 154 'edge': 'edgeInfo.js.tmpl', |
155 'gecko-webext': 'geckoInfo.js.tmpl' | 155 'gecko': 'geckoInfo.js.tmpl' |
156 } | 156 } |
157 | 157 |
158 # Historically we didn't use relative paths when requiring modules, so in | 158 # Historically we didn't use relative paths when requiring modules, so in |
159 # order for webpack to know where to find them we need to pass in a list of | 159 # order for webpack to know where to find them we need to pass in a list of |
160 # resolve paths. Going forward we should always use relative paths, once we | 160 # resolve paths. Going forward we should always use relative paths, once we |
161 # do that consistently this can be removed. See issues 5760, 5761 and 5762. | 161 # do that consistently this can be removed. See issues 5760, 5761 and 5762. |
162 resolve_paths = [os.path.join(base_extension_path, dir, 'lib') | 162 resolve_paths = [os.path.join(base_extension_path, dir, 'lib') |
163 for dir in ['', 'adblockpluscore', 'adblockplusui']] | 163 for dir in ['', 'adblockpluscore', 'adblockplusui']] |
164 | 164 |
165 info_template = getTemplate(info_templates[params['type']]) | 165 info_template = getTemplate(info_templates[params['type']]) |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 file.write(pubkey) | 312 file.write(pubkey) |
313 file.write(signature) | 313 file.write(signature) |
314 file.write(zipdata) | 314 file.write(zipdata) |
315 | 315 |
316 | 316 |
317 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil
d=False, keyFile=None, devenv=False): | 317 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil
d=False, keyFile=None, devenv=False): |
318 metadata = readMetadata(baseDir, type) | 318 metadata = readMetadata(baseDir, type) |
319 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) | 319 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) |
320 | 320 |
321 if outFile == None: | 321 if outFile == None: |
322 if type == 'gecko-webext': | 322 if type == 'gecko': |
323 file_extension = 'xpi' | 323 file_extension = 'xpi' |
324 else: | 324 else: |
325 file_extension = 'crx' if keyFile else 'zip' | 325 file_extension = 'crx' if keyFile else 'zip' |
326 outFile = getDefaultFileName(metadata, version, file_extension) | 326 outFile = getDefaultFileName(metadata, version, file_extension) |
327 | 327 |
328 params = { | 328 params = { |
329 'type': type, | 329 'type': type, |
330 'baseDir': baseDir, | 330 'baseDir': baseDir, |
331 'releaseBuild': releaseBuild, | 331 'releaseBuild': releaseBuild, |
332 'version': version, | 332 'version': version, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 params, 'testIndex.html.tmpl', ('general', 'testScripts') | 368 params, 'testIndex.html.tmpl', ('general', 'testScripts') |
369 ) | 369 ) |
370 | 370 |
371 zipdata = files.zipToString() | 371 zipdata = files.zipToString() |
372 signature = None | 372 signature = None |
373 pubkey = None | 373 pubkey = None |
374 if keyFile != None: | 374 if keyFile != None: |
375 signature = signBinary(zipdata, keyFile) | 375 signature = signBinary(zipdata, keyFile) |
376 pubkey = getPublicKey(keyFile) | 376 pubkey = getPublicKey(keyFile) |
377 writePackage(outFile, pubkey, signature, zipdata) | 377 writePackage(outFile, pubkey, signature, zipdata) |
OLD | NEW |