| 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 os | 5 import os |
| 6 import sys | 6 import sys |
| 7 import re | 7 import re |
| 8 import subprocess | 8 import subprocess |
| 9 import shutil | 9 import shutil |
| 10 from getopt import getopt, GetoptError | 10 from getopt import getopt, GetoptError |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 devenv_dir = getDevEnvPath(baseDir, type) | 211 devenv_dir = getDevEnvPath(baseDir, type) |
| 212 | 212 |
| 213 shutil.rmtree(devenv_dir, ignore_errors=True) | 213 shutil.rmtree(devenv_dir, ignore_errors=True) |
| 214 | 214 |
| 215 file.seek(0) | 215 file.seek(0) |
| 216 with ZipFile(file, 'r') as zip_file: | 216 with ZipFile(file, 'r') as zip_file: |
| 217 zip_file.extractall(devenv_dir) | 217 zip_file.extractall(devenv_dir) |
| 218 | 218 |
| 219 | 219 |
| 220 def readLocaleConfig(baseDir, type, metadata): | 220 def readLocaleConfig(baseDir, type, metadata): |
| 221 if type != 'generic': | 221 if type != 'generic': |
|
Vasily Kuznetsov
2017/10/10 12:44:33
We could swap the branches of this if statement to
tlucas
2017/10/10 12:50:13
Well, imho the "not generic" platforms are those m
| |
| 222 import buildtools.packagerChrome as packager | 222 import buildtools.packagerChrome as packager |
| 223 localeDir = os.path.join(baseDir, '_locales') | 223 localeDir = os.path.join(baseDir, '_locales') |
| 224 localeConfig = { | 224 localeConfig = { |
| 225 'default_locale': packager.defaultLocale, | 225 'default_locale': packager.defaultLocale, |
| 226 } | 226 } |
| 227 else: | 227 else: |
| 228 localeDir = os.path.join( | 228 localeDir = os.path.join( |
| 229 baseDir, *metadata.get('locales', 'base_path').split('/') | 229 baseDir, *metadata.get('locales', 'base_path').split('/') |
| 230 ) | 230 ) |
| 231 localeConfig = { | 231 localeConfig = { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 return | 376 return |
| 377 | 377 |
| 378 import buildtools.releaseAutomation as releaseAutomation | 378 import buildtools.releaseAutomation as releaseAutomation |
| 379 releaseAutomation.run(baseDir, type, version, keyFile, downloadsRepo) | 379 releaseAutomation.run(baseDir, type, version, keyFile, downloadsRepo) |
| 380 | 380 |
| 381 | 381 |
| 382 def updatePSL(baseDir, scriptName, opts, args, type): | 382 def updatePSL(baseDir, scriptName, opts, args, type): |
| 383 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater | 383 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater |
| 384 publicSuffixListUpdater.updatePSL(baseDir) | 384 publicSuffixListUpdater.updatePSL(baseDir) |
| 385 | 385 |
| 386 | 386 |
|
tlucas
2017/10/06 09:06:49
This line would have been the only one to have to
| |
| 387 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName, type), ('help', '-h', '--help')) as command: | 387 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName, type), ('help', '-h', '--help')) as command: |
| 388 command.shortDescription = 'Show this message' | 388 command.shortDescription = 'Show this message' |
| 389 | 389 |
| 390 with addCommand(runBuild, 'build') as command: | 390 with addCommand(runBuild, 'build') as command: |
| 391 command.shortDescription = 'Create a build' | 391 command.shortDescription = 'Create a build' |
| 392 command.description = 'Creates an extension build with given file name. If o utput_file is missing a default name will be chosen.' | 392 command.description = 'Creates an extension build with given file name. If o utput_file is missing a default name will be chosen.' |
| 393 command.params = '[options] [output_file]' | 393 command.params = '[options] [output_file]' |
| 394 command.addOption('Use given build number (if omitted the build number will be retrieved from Mercurial)', short='b', long='build', value='num') | 394 command.addOption('Use given build number (if omitted the build number will be retrieved from Mercurial)', short='b', long='build', value='num') |
| 395 command.addOption('File containing private key and certificates required to sign the package', short='k', long='key', value='file', types=('chrome', 'safari ')) | 395 command.addOption('File containing private key and certificates required to sign the package', short='k', long='key', value='file', types=('chrome', 'safari ')) |
| 396 command.addOption('Create a release build', short='r', long='release') | 396 command.addOption('Create a release build', short='r', long='release') |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 if option in ('-h', '--help'): | 508 if option in ('-h', '--help'): |
| 509 usage(scriptName, type, command) | 509 usage(scriptName, type, command) |
| 510 sys.exit() | 510 sys.exit() |
| 511 commands[command](baseDir, scriptName, opts, args, type) | 511 commands[command](baseDir, scriptName, opts, args, type) |
| 512 else: | 512 else: |
| 513 print 'Command %s is not supported for this application type' % comm and | 513 print 'Command %s is not supported for this application type' % comm and |
| 514 usage(scriptName, type) | 514 usage(scriptName, type) |
| 515 else: | 515 else: |
| 516 print 'Command %s is unrecognized' % command | 516 print 'Command %s is unrecognized' % command |
| 517 usage(scriptName, type) | 517 usage(scriptName, type) |
| LEFT | RIGHT |