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, keyFile=keyFile) |
| 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 | 422 |
419 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: |
420 command.shortDescription = 'Show this message' | 424 command.shortDescription = 'Show this message' |
421 | 425 |
422 with addCommand(runBuild, 'build') as command: | 426 with addCommand(runBuild, 'build') as command: |
423 command.shortDescription = 'Create a build' | 427 command.shortDescription = 'Create a build' |
424 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.' |
425 command.params = '[options] [output_file]' | 429 command.params = '[options] [output_file]' |
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')) | 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')) |
427 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') |
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')) | 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')) |
429 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')) |
430 command.addOption('Create a release build', short='r', long='release') | 434 command.addOption('Create a release build', short='r', long='release') |
431 command.addOption('Enable use of experimental APIs', long='experimental') | 435 command.addOption('Enable use of experimental APIs', long='experimental') |
432 command.supportedTypes = ('gecko', 'chrome', 'opera') | 436 command.supportedTypes = ('gecko', 'chrome', 'opera', 'safari') |
433 | 437 |
434 with addCommand(runAutoInstall, 'autoinstall') as command: | 438 with addCommand(runAutoInstall, 'autoinstall') as command: |
435 command.shortDescription = 'Install extension automatically' | 439 command.shortDescription = 'Install extension automatically' |
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.' | 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.' |
437 command.params = '[<host>:]<port>' | 441 command.params = '[<host>:]<port>' |
438 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') |
439 command.supportedTypes = ('gecko') | 443 command.supportedTypes = ('gecko') |
440 | 444 |
441 with addCommand(createDevEnv, 'devenv') as command: | 445 with addCommand(createDevEnv, 'devenv') as command: |
442 command.shortDescription = 'Set up a development environment' | 446 command.shortDescription = 'Set up a development environment' |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 if option in ('-h', '--help'): | 566 if option in ('-h', '--help'): |
563 usage(scriptName, type, command) | 567 usage(scriptName, type, command) |
564 sys.exit() | 568 sys.exit() |
565 commands[command](baseDir, scriptName, opts, args, type) | 569 commands[command](baseDir, scriptName, opts, args, type) |
566 else: | 570 else: |
567 print 'Command %s is not supported for this application type' % command | 571 print 'Command %s is not supported for this application type' % command |
568 usage(scriptName, type) | 572 usage(scriptName, type) |
569 else: | 573 else: |
570 print 'Command %s is unrecognized' % command | 574 print 'Command %s is unrecognized' % command |
571 usage(scriptName, type) | 575 usage(scriptName, type) |
OLD | NEW |