| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 file = open(outputFile, 'wb') | 312 file = open(outputFile, 'wb') |
| 313 else: | 313 else: |
| 314 file = outputFile | 314 file = outputFile |
| 315 if pubkey != None and signature != None: | 315 if pubkey != None and signature != None: |
| 316 file.write(struct.pack('<4sIII', 'Cr24', 2, len(pubkey), len(signature))
) | 316 file.write(struct.pack('<4sIII', 'Cr24', 2, len(pubkey), len(signature))
) |
| 317 file.write(pubkey) | 317 file.write(pubkey) |
| 318 file.write(signature) | 318 file.write(signature) |
| 319 file.write(zipdata) | 319 file.write(zipdata) |
| 320 | 320 |
| 321 | 321 |
| 322 def add_devenv_requirements(files, metadata, params): |
| 323 import buildtools |
| 324 import random |
| 325 files.read(os.path.join(buildtools.__path__[0], 'chromeDevenvPoller__.js'), |
| 326 relpath='devenvPoller__.js') |
| 327 files['devenvVersion__'] = str(random.random()) |
| 328 |
| 329 if metadata.has_option('general', 'testScripts'): |
| 330 files['qunit/index.html'] = createScriptPage( |
| 331 params, 'testIndex.html.tmpl', ('general', 'testScripts') |
| 332 ) |
| 333 |
| 334 |
| 322 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil
d=False, keyFile=None, devenv=False): | 335 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil
d=False, keyFile=None, devenv=False): |
| 323 metadata = readMetadata(baseDir, type) | 336 metadata = readMetadata(baseDir, type) |
| 324 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) | 337 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) |
| 325 | 338 |
| 326 if outFile == None: | 339 if outFile == None: |
| 327 if type == 'gecko': | 340 if type == 'gecko': |
| 328 file_extension = 'xpi' | 341 file_extension = 'xpi' |
| 329 else: | 342 else: |
| 330 file_extension = 'crx' if keyFile else 'zip' | 343 file_extension = 'crx' if keyFile else 'zip' |
| 331 outFile = getDefaultFileName(metadata, version, file_extension) | 344 outFile = getDefaultFileName(metadata, version, file_extension) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 356 ) | 369 ) |
| 357 | 370 |
| 358 if metadata.has_section('import_locales'): | 371 if metadata.has_section('import_locales'): |
| 359 import_locales(params, files) | 372 import_locales(params, files) |
| 360 | 373 |
| 361 files['manifest.json'] = createManifest(params, files) | 374 files['manifest.json'] = createManifest(params, files) |
| 362 if type == 'chrome': | 375 if type == 'chrome': |
| 363 fix_translations_for_chrome(files) | 376 fix_translations_for_chrome(files) |
| 364 | 377 |
| 365 if devenv: | 378 if devenv: |
| 366 import buildtools | 379 add_devenv_requirements(files, metadata, params) |
| 367 import random | |
| 368 files.read(os.path.join(buildtools.__path__[0], 'chromeDevenvPoller__.js
'), relpath='devenvPoller__.js') | |
| 369 files['devenvVersion__'] = str(random.random()) | |
| 370 | |
| 371 if metadata.has_option('general', 'testScripts'): | |
| 372 files['qunit/index.html'] = createScriptPage( | |
| 373 params, 'testIndex.html.tmpl', ('general', 'testScripts') | |
| 374 ) | |
| 375 | 380 |
| 376 zipdata = files.zipToString() | 381 zipdata = files.zipToString() |
| 377 signature = None | 382 signature = None |
| 378 pubkey = None | 383 pubkey = None |
| 379 if keyFile != None: | 384 if keyFile != None: |
| 380 signature = signBinary(zipdata, keyFile) | 385 signature = signBinary(zipdata, keyFile) |
| 381 pubkey = getPublicKey(keyFile) | 386 pubkey = getPublicKey(keyFile) |
| 382 writePackage(outFile, pubkey, signature, zipdata) | 387 writePackage(outFile, pubkey, signature, zipdata) |
| OLD | NEW |