| OLD | NEW | 
|---|
| 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, | 
| 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 13 # GNU General Public License for more details. | 13 # GNU General Public License for more details. | 
| 14 # | 14 # | 
| 15 # You should have received a copy of the GNU General Public License | 15 # You should have received a copy of the GNU General Public License | 
| 16 # along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 16 # along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
| 17 | 17 | 
| 18 import os, sys, re, subprocess, buildtools | 18 import os, sys, re, subprocess, buildtools | 
| 19 from getopt import getopt, GetoptError | 19 from getopt import getopt, GetoptError | 
| 20 | 20 | 
| 21 knownTypes = ('gecko', 'chrome', 'opera') | 21 knownTypes = ('gecko', 'chrome', 'opera', 'safari') | 
| 22 | 22 | 
| 23 class Command(object): | 23 class Command(object): | 
| 24   name = property(lambda self: self._name) | 24   name = property(lambda self: self._name) | 
| 25   shortDescription = property(lambda self: self._shortDescription, | 25   shortDescription = property(lambda self: self._shortDescription, | 
| 26       lambda self, value: self.__dict__.update({'_shortDescription': value})) | 26       lambda self, value: self.__dict__.update({'_shortDescription': value})) | 
| 27   description = property(lambda self: self._description, | 27   description = property(lambda self: self._description, | 
| 28       lambda self, value: self.__dict__.update({'_description': value})) | 28       lambda self, value: self.__dict__.update({'_description': value})) | 
| 29   params = property(lambda self: self._params, | 29   params = property(lambda self: self._params, | 
| 30       lambda self, value: self.__dict__.update({'_params': value})) | 30       lambda self, value: self.__dict__.update({'_params': value})) | 
| 31   supportedTypes = property(lambda self: self._supportedTypes, | 31   supportedTypes = property(lambda self: self._supportedTypes, | 
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 193   if type == 'gecko': | 193   if type == 'gecko': | 
| 194     import buildtools.packagerGecko as packager | 194     import buildtools.packagerGecko as packager | 
| 195     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, | 
| 196                          releaseBuild=releaseBuild, keyFile=keyFile, | 196                          releaseBuild=releaseBuild, keyFile=keyFile, | 
| 197                          multicompartment=multicompartment) | 197                          multicompartment=multicompartment) | 
| 198   elif type == 'chrome' or type == 'opera': | 198   elif type == 'chrome' or type == 'opera': | 
| 199     import buildtools.packagerChrome as packager | 199     import buildtools.packagerChrome as packager | 
| 200     packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum, | 200     packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum, | 
| 201                          releaseBuild=releaseBuild, keyFile=keyFile, | 201                          releaseBuild=releaseBuild, keyFile=keyFile, | 
| 202                          experimentalAPI=experimentalAPI) | 202                          experimentalAPI=experimentalAPI) | 
|  | 203   elif type == 'safari': | 
|  | 204     import buildtools.packagerSafari as packager | 
|  | 205     packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum,
      releaseBuild=releaseBuild) | 
|  | 206 | 
| 203 | 207 | 
| 204 | 208 | 
| 205 def runAutoInstall(baseDir, scriptName, opts, args, type): | 209 def runAutoInstall(baseDir, scriptName, opts, args, type): | 
| 206   if len(args) == 0: | 210   if len(args) == 0: | 
| 207     print 'Port of the Extension Auto-Installer needs to be specified' | 211     print 'Port of the Extension Auto-Installer needs to be specified' | 
| 208     usage(scriptName, type, 'autoinstall') | 212     usage(scriptName, type, 'autoinstall') | 
| 209     return | 213     return | 
| 210 | 214 | 
| 211   multicompartment = False | 215   multicompartment = False | 
| 212   for option, value in opts: | 216   for option, value in opts: | 
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 418 with addCommand(runBuild, 'build') as command: | 422 with addCommand(runBuild, 'build') as command: | 
| 419   command.shortDescription = 'Create a build' | 423   command.shortDescription = 'Create a build' | 
| 420   command.description = 'Creates an extension build with given file name. If out
     put_file is missing a default name will be chosen.' | 424   command.description = 'Creates an extension build with given file name. If out
     put_file is missing a default name will be chosen.' | 
| 421   command.params = '[options] [output_file]' | 425   command.params = '[options] [output_file]' | 
| 422   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')) | 426   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')) | 
| 423   command.addOption('Use given build number (if omitted the build number will be
      retrieved from Mercurial)', short='b', long='build', value='num') | 427   command.addOption('Use given build number (if omitted the build number will be
      retrieved from Mercurial)', short='b', long='build', value='num') | 
| 424   command.addOption('File containing private key and certificates required to si
     gn the package', short='k', long='key', value='file', types=('gecko', 'chrome', 
     'opera')) | 428   command.addOption('File containing private key and certificates required to si
     gn the package', short='k', long='key', value='file', types=('gecko', 'chrome', 
     'opera')) | 
| 425   command.addOption('Create a build for leak testing', short='m', long='multi-co
     mpartment', types=('gecko')) | 429   command.addOption('Create a build for leak testing', short='m', long='multi-co
     mpartment', types=('gecko')) | 
| 426   command.addOption('Create a release build', short='r', long='release') | 430   command.addOption('Create a release build', short='r', long='release') | 
| 427   command.addOption('Enable use of experimental APIs', long='experimental') | 431   command.addOption('Enable use of experimental APIs', long='experimental') | 
| 428   command.supportedTypes = ('gecko', 'chrome', 'opera') | 432   command.supportedTypes = ('gecko', 'chrome', 'opera', 'safari') | 
| 429 | 433 | 
| 430 with addCommand(runAutoInstall, 'autoinstall') as command: | 434 with addCommand(runAutoInstall, 'autoinstall') as command: | 
| 431   command.shortDescription = 'Install extension automatically' | 435   command.shortDescription = 'Install extension automatically' | 
| 432   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.' | 436   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.' | 
| 433   command.params = '[<host>:]<port>' | 437   command.params = '[<host>:]<port>' | 
| 434   command.addOption('Create a build for leak testing', short='m', long='multi-co
     mpartment') | 438   command.addOption('Create a build for leak testing', short='m', long='multi-co
     mpartment') | 
| 435   command.supportedTypes = ('gecko') | 439   command.supportedTypes = ('gecko') | 
| 436 | 440 | 
| 437 with addCommand(createDevEnv, 'devenv') as command: | 441 with addCommand(createDevEnv, 'devenv') as command: | 
| 438   command.shortDescription = 'Set up a development environment' | 442   command.shortDescription = 'Set up a development environment' | 
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 558         if option in ('-h', '--help'): | 562         if option in ('-h', '--help'): | 
| 559           usage(scriptName, type, command) | 563           usage(scriptName, type, command) | 
| 560           sys.exit() | 564           sys.exit() | 
| 561       commands[command](baseDir, scriptName, opts, args, type) | 565       commands[command](baseDir, scriptName, opts, args, type) | 
| 562     else: | 566     else: | 
| 563       print 'Command %s is not supported for this application type' % command | 567       print 'Command %s is not supported for this application type' % command | 
| 564       usage(scriptName, type) | 568       usage(scriptName, type) | 
| 565   else: | 569   else: | 
| 566     print 'Command %s is unrecognized' % command | 570     print 'Command %s is unrecognized' % command | 
| 567     usage(scriptName, type) | 571     usage(scriptName, type) | 
| OLD | NEW | 
|---|