Left: | ||
Right: |
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 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 file = open(outputFile, 'wb') | 298 file = open(outputFile, 'wb') |
299 else: | 299 else: |
300 file = outputFile | 300 file = outputFile |
301 if pubkey != None and signature != None: | 301 if pubkey != None and signature != None: |
302 file.write(struct.pack('<4sIII', 'Cr24', 2, len(pubkey), len(signature)) ) | 302 file.write(struct.pack('<4sIII', 'Cr24', 2, len(pubkey), len(signature)) ) |
303 file.write(pubkey) | 303 file.write(pubkey) |
304 file.write(signature) | 304 file.write(signature) |
305 file.write(zipdata) | 305 file.write(zipdata) |
306 | 306 |
307 | 307 |
308 def add_devenv_requirements(files, metadata, params): | |
309 import buildtools | |
Sebastian Noack
2017/10/17 21:29:52
If we determine the path relative to this module (
tlucas
2017/10/18 09:27:49
Done.
| |
310 import random | |
Sebastian Noack
2017/10/17 21:29:52
This import can go to the top of the module.
tlucas
2017/10/18 09:27:49
Done.
| |
311 files.read(os.path.join(buildtools.__path__[0], 'chromeDevenvPoller__.js'), | |
312 relpath='devenvPoller__.js') | |
313 files['devenvVersion__'] = str(random.random()) | |
314 | |
315 if metadata.has_option('general', 'testScripts'): | |
316 files['qunit/index.html'] = createScriptPage( | |
317 params, 'testIndex.html.tmpl', ('general', 'testScripts') | |
318 ) | |
319 | |
320 | |
308 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil d=False, keyFile=None, devenv=False): | 321 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil d=False, keyFile=None, devenv=False): |
309 metadata = readMetadata(baseDir, type) | 322 metadata = readMetadata(baseDir, type) |
310 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) | 323 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) |
311 | 324 |
312 if outFile == None: | 325 if outFile == None: |
313 if type == 'gecko': | 326 if type == 'gecko': |
314 file_extension = 'xpi' | 327 file_extension = 'xpi' |
315 else: | 328 else: |
316 file_extension = 'crx' if keyFile else 'zip' | 329 file_extension = 'crx' if keyFile else 'zip' |
317 outFile = getDefaultFileName(metadata, version, file_extension) | 330 outFile = getDefaultFileName(metadata, version, file_extension) |
(...skipping 24 matching lines...) Expand all Loading... | |
342 ) | 355 ) |
343 | 356 |
344 if metadata.has_section('import_locales'): | 357 if metadata.has_section('import_locales'): |
345 import_locales(params, files) | 358 import_locales(params, files) |
346 | 359 |
347 files['manifest.json'] = createManifest(params, files) | 360 files['manifest.json'] = createManifest(params, files) |
348 if type == 'chrome': | 361 if type == 'chrome': |
349 fix_translations_for_chrome(files) | 362 fix_translations_for_chrome(files) |
350 | 363 |
351 if devenv: | 364 if devenv: |
352 import buildtools | 365 add_devenv_requirements(files, metadata, params) |
353 import random | |
354 files.read(os.path.join(buildtools.__path__[0], 'chromeDevenvPoller__.js '), relpath='devenvPoller__.js') | |
355 files['devenvVersion__'] = str(random.random()) | |
356 | |
357 if metadata.has_option('general', 'testScripts'): | |
358 files['qunit/index.html'] = createScriptPage( | |
359 params, 'testIndex.html.tmpl', ('general', 'testScripts') | |
360 ) | |
361 | 366 |
362 zipdata = files.zipToString() | 367 zipdata = files.zipToString() |
363 signature = None | 368 signature = None |
364 pubkey = None | 369 pubkey = None |
365 if keyFile != None: | 370 if keyFile != None: |
366 signature = signBinary(zipdata, keyFile) | 371 signature = signBinary(zipdata, keyFile) |
367 pubkey = getPublicKey(keyFile) | 372 pubkey = getPublicKey(keyFile) |
368 writePackage(outFile, pubkey, signature, zipdata) | 373 writePackage(outFile, pubkey, signature, zipdata) |
OLD | NEW |