| LEFT | RIGHT |
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 2 | 2 |
| 3 # This file is part of the Adblock Plus build tools, | 3 # This file is part of the Adblock Plus build tools, |
| 4 # Copyright (C) 2006-2013 Eyeo GmbH | 4 # Copyright (C) 2006-2013 Eyeo GmbH |
| 5 # | 5 # |
| 6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
| 7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
| 8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
| 9 # | 9 # |
| 10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 168 } |
| 169 | 169 |
| 170 | 170 |
| 171 def runBuild(baseDir, scriptName, opts, args, type): | 171 def runBuild(baseDir, scriptName, opts, args, type): |
| 172 locales = None | 172 locales = None |
| 173 buildNum = None | 173 buildNum = None |
| 174 multicompartment = False | 174 multicompartment = False |
| 175 releaseBuild = False | 175 releaseBuild = False |
| 176 keyFile = None | 176 keyFile = None |
| 177 experimentalAPI = False | 177 experimentalAPI = False |
| 178 certs = [] | |
| 179 for option, value in opts: | 178 for option, value in opts: |
| 180 if option in ('-l', '--locales'): | 179 if option in ('-l', '--locales'): |
| 181 locales = value.split(',') | 180 locales = value.split(',') |
| 182 elif option in ('-b', '--build'): | 181 elif option in ('-b', '--build'): |
| 183 buildNum = int(value) | 182 buildNum = int(value) |
| 184 elif option in ('-k', '--key'): | 183 elif option in ('-k', '--key'): |
| 185 keyFile = value | 184 keyFile = value |
| 186 elif option in ('-m', '--multi-compartment'): | 185 elif option in ('-m', '--multi-compartment'): |
| 187 multicompartment = True | 186 multicompartment = True |
| 188 elif option in ('-r', '--release'): | 187 elif option in ('-r', '--release'): |
| 189 releaseBuild = True | 188 releaseBuild = True |
| 190 elif option == '--experimental': | 189 elif option == '--experimental': |
| 191 experimentalAPI = True | 190 experimentalAPI = True |
| 192 elif option == '--cert': | |
| 193 certs.append(value) | |
| 194 outFile = args[0] if len(args) > 0 else None | 191 outFile = args[0] if len(args) > 0 else None |
| 195 | 192 |
| 196 if type == 'gecko': | 193 if type == 'gecko': |
| 197 import buildtools.packagerGecko as packager | 194 import buildtools.packagerGecko as packager |
| 198 packager.createBuild(baseDir, type=type, outFile=outFile, locales=locales, b
uildNum=buildNum, | 195 packager.createBuild(baseDir, type=type, outFile=outFile, locales=locales, b
uildNum=buildNum, |
| 199 releaseBuild=releaseBuild, keyFile=keyFile, | 196 releaseBuild=releaseBuild, keyFile=keyFile, |
| 200 multicompartment=multicompartment) | 197 multicompartment=multicompartment) |
| 201 elif type == 'chrome' or type == 'opera': | 198 elif type == 'chrome' or type == 'opera': |
| 202 import buildtools.packagerChrome as packager | 199 import buildtools.packagerChrome as packager |
| 203 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum, | 200 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum, |
| 204 releaseBuild=releaseBuild, keyFile=keyFile, | 201 releaseBuild=releaseBuild, keyFile=keyFile, |
| 205 experimentalAPI=experimentalAPI) | 202 experimentalAPI=experimentalAPI) |
| 206 elif type == 'safari': | 203 elif type == 'safari': |
| 207 import buildtools.packagerSafari as packager | 204 import buildtools.packagerSafari as packager |
| 208 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum,
releaseBuild=releaseBuild, keyFile=keyFile, certs=certs) | 205 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum, |
| 209 | 206 releaseBuild=releaseBuild, keyFile=keyFile) |
| 210 | 207 |
| 211 | 208 |
| 212 def runAutoInstall(baseDir, scriptName, opts, args, type): | 209 def runAutoInstall(baseDir, scriptName, opts, args, type): |
| 213 if len(args) == 0: | 210 if len(args) == 0: |
| 214 print 'Port of the Extension Auto-Installer needs to be specified' | 211 print 'Port of the Extension Auto-Installer needs to be specified' |
| 215 usage(scriptName, type, 'autoinstall') | 212 usage(scriptName, type, 'autoinstall') |
| 216 return | 213 return |
| 217 | 214 |
| 218 multicompartment = False | 215 multicompartment = False |
| 219 for option, value in opts: | 216 for option, value in opts: |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName,
type), ('help', '-h', '--help')) as command: | 423 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName,
type), ('help', '-h', '--help')) as command: |
| 427 command.shortDescription = 'Show this message' | 424 command.shortDescription = 'Show this message' |
| 428 | 425 |
| 429 with addCommand(runBuild, 'build') as command: | 426 with addCommand(runBuild, 'build') as command: |
| 430 command.shortDescription = 'Create a build' | 427 command.shortDescription = 'Create a build' |
| 431 command.description = 'Creates an extension build with given file name. If out
put_file is missing a default name will be chosen.' | 428 command.description = 'Creates an extension build with given file name. If out
put_file is missing a default name will be chosen.' |
| 432 command.params = '[options] [output_file]' | 429 command.params = '[options] [output_file]' |
| 433 command.addOption('Only include the given locales (if omitted: all locales not
marked as incomplete)', short='l', long='locales', value='l1,l2,l3', types=('ge
cko')) | 430 command.addOption('Only include the given locales (if omitted: all locales not
marked as incomplete)', short='l', long='locales', value='l1,l2,l3', types=('ge
cko')) |
| 434 command.addOption('Use given build number (if omitted the build number will be
retrieved from Mercurial)', short='b', long='build', value='num') | 431 command.addOption('Use given build number (if omitted the build number will be
retrieved from Mercurial)', short='b', long='build', value='num') |
| 435 command.addOption('File containing private key and certificates required to si
gn the package', short='k', long='key', value='file', types=('gecko', 'chrome',
'opera', 'safari')) | 432 command.addOption('File containing private key and certificates required to si
gn the package', short='k', long='key', value='file', types=('gecko', 'chrome',
'opera', 'safari')) |
| 436 command.addOption('File containing an X509 certificate to be inlcuded into the
package. Can be given multiple times.', long='cert', value='file', types=('safa
ri',)) | |
| 437 command.addOption('Create a build for leak testing', short='m', long='multi-co
mpartment', types=('gecko')) | 433 command.addOption('Create a build for leak testing', short='m', long='multi-co
mpartment', types=('gecko')) |
| 438 command.addOption('Create a release build', short='r', long='release') | 434 command.addOption('Create a release build', short='r', long='release') |
| 439 command.addOption('Enable use of experimental APIs', long='experimental') | 435 command.addOption('Enable use of experimental APIs', long='experimental') |
| 440 command.supportedTypes = ('gecko', 'chrome', 'opera', 'safari') | 436 command.supportedTypes = ('gecko', 'chrome', 'opera', 'safari') |
| 441 | 437 |
| 442 with addCommand(runAutoInstall, 'autoinstall') as command: | 438 with addCommand(runAutoInstall, 'autoinstall') as command: |
| 443 command.shortDescription = 'Install extension automatically' | 439 command.shortDescription = 'Install extension automatically' |
| 444 command.description = 'Will automatically install the extension in a browser r
unning Extension Auto-Installer. If host parameter is omitted assumes that the b
rowser runs on localhost.' | 440 command.description = 'Will automatically install the extension in a browser r
unning Extension Auto-Installer. If host parameter is omitted assumes that the b
rowser runs on localhost.' |
| 445 command.params = '[<host>:]<port>' | 441 command.params = '[<host>:]<port>' |
| 446 command.addOption('Create a build for leak testing', short='m', long='multi-co
mpartment') | 442 command.addOption('Create a build for leak testing', short='m', long='multi-co
mpartment') |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 if option in ('-h', '--help'): | 566 if option in ('-h', '--help'): |
| 571 usage(scriptName, type, command) | 567 usage(scriptName, type, command) |
| 572 sys.exit() | 568 sys.exit() |
| 573 commands[command](baseDir, scriptName, opts, args, type) | 569 commands[command](baseDir, scriptName, opts, args, type) |
| 574 else: | 570 else: |
| 575 print 'Command %s is not supported for this application type' % command | 571 print 'Command %s is not supported for this application type' % command |
| 576 usage(scriptName, type) | 572 usage(scriptName, type) |
| 577 else: | 573 else: |
| 578 print 'Command %s is unrecognized' % command | 574 print 'Command %s is unrecognized' % command |
| 579 usage(scriptName, type) | 575 usage(scriptName, type) |
| LEFT | RIGHT |