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-2012 Eyeo GmbH | 4 # Copyright (C) 2006-2012 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 import buildtools.packagerGecko as packager | 191 import buildtools.packagerGecko as packager |
192 packager.createBuild(baseDir, outFile=outFile, locales=locales, buildNum=bui
ldNum, | 192 packager.createBuild(baseDir, outFile=outFile, locales=locales, buildNum=bui
ldNum, |
193 releaseBuild=releaseBuild, keyFile=keyFile, | 193 releaseBuild=releaseBuild, keyFile=keyFile, |
194 limitMetadata=limitMetadata, multicompartment=multicomp
artment) | 194 limitMetadata=limitMetadata, multicompartment=multicomp
artment) |
195 elif type == 'chrome': | 195 elif type == 'chrome': |
196 import buildtools.packagerChrome as packager | 196 import buildtools.packagerChrome as packager |
197 packager.createBuild(baseDir, outFile=outFile, buildNum=buildNum, | 197 packager.createBuild(baseDir, outFile=outFile, buildNum=buildNum, |
198 releaseBuild=releaseBuild, keyFile=keyFile, | 198 releaseBuild=releaseBuild, keyFile=keyFile, |
199 experimentalAPI=experimentalAPI) | 199 experimentalAPI=experimentalAPI) |
200 | 200 |
| 201 |
201 def runAutoInstall(baseDir, scriptName, opts, args, type): | 202 def runAutoInstall(baseDir, scriptName, opts, args, type): |
202 if len(args) == 0: | 203 if len(args) == 0: |
203 print 'Port of the Extension Auto-Installer needs to be specified' | 204 print 'Port of the Extension Auto-Installer needs to be specified' |
204 usage(scriptName, type, 'autoinstall') | 205 usage(scriptName, type, 'autoinstall') |
205 return | 206 return |
206 | 207 |
207 multicompartment = False | 208 multicompartment = False |
208 for option, value in opts: | 209 for option, value in opts: |
209 if option in ('-m', '--multi-compartment'): | 210 if option in ('-m', '--multi-compartment'): |
210 multicompartment = True | 211 multicompartment = True |
211 | 212 |
212 if ':' in args[0]: | 213 if ':' in args[0]: |
213 host, port = args[0].rsplit(':', 1) | 214 host, port = args[0].rsplit(':', 1) |
214 else: | 215 else: |
215 host, port = ('localhost', args[0]) | 216 host, port = ('localhost', args[0]) |
216 | 217 |
217 import buildtools.packagerGecko as packager | 218 import buildtools.packagerGecko as packager |
218 packager.autoInstall(baseDir, host, port, multicompartment=multicompartment) | 219 packager.autoInstall(baseDir, host, port, multicompartment=multicompartment) |
219 | 220 |
220 | 221 |
| 222 def createDevEnv(baseDir, scriptName, opts, args, type): |
| 223 import buildtools.packagerChrome as packager |
| 224 packager.createDevEnv(baseDir) |
| 225 |
| 226 |
221 def setupTranslations(baseDir, scriptName, opts, args, type): | 227 def setupTranslations(baseDir, scriptName, opts, args, type): |
222 if len(args) < 1: | 228 if len(args) < 1: |
223 print 'Project key is required to update translation master files.' | 229 print 'Project key is required to update translation master files.' |
224 usage(scriptName, type, 'setuptrans') | 230 usage(scriptName, type, 'setuptrans') |
225 return | 231 return |
226 | 232 |
227 key = args[0] | 233 key = args[0] |
228 | 234 |
229 if type == 'chrome': | 235 if type == 'chrome': |
230 import buildtools.packagerChrome as packager | 236 import buildtools.packagerChrome as packager |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 command.addOption('Enable use of experimental APIs', long='experimental') | 431 command.addOption('Enable use of experimental APIs', long='experimental') |
426 command.supportedTypes = ('gecko', 'chrome') | 432 command.supportedTypes = ('gecko', 'chrome') |
427 | 433 |
428 with addCommand(runAutoInstall, 'autoinstall') as command: | 434 with addCommand(runAutoInstall, 'autoinstall') as command: |
429 command.shortDescription = 'Install extension automatically' | 435 command.shortDescription = 'Install extension automatically' |
430 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.' |
431 command.params = '[<host>:]<port>' | 437 command.params = '[<host>:]<port>' |
432 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') |
433 command.supportedTypes = ('gecko') | 439 command.supportedTypes = ('gecko') |
434 | 440 |
| 441 with addCommand(createDevEnv, 'devenv') as command: |
| 442 command.shortDescription = 'Set up a development environment' |
| 443 command.description = 'Will set up or update the devenv folder as an unpacked
extension folder for development.' |
| 444 command.supportedTypes = ('chrome') |
| 445 |
435 with addCommand(setupTranslations, 'setuptrans') as command: | 446 with addCommand(setupTranslations, 'setuptrans') as command: |
436 command.shortDescription = 'Sets up translation languages' | 447 command.shortDescription = 'Sets up translation languages' |
437 command.description = 'Sets up translation languages for the project on crowdi
n.net.' | 448 command.description = 'Sets up translation languages for the project on crowdi
n.net.' |
438 command.params = '[options] project-key' | 449 command.params = '[options] project-key' |
439 command.supportedTypes = ('gecko', 'chrome') | 450 command.supportedTypes = ('gecko', 'chrome') |
440 | 451 |
441 with addCommand(updateTranslationMaster, 'translate') as command: | 452 with addCommand(updateTranslationMaster, 'translate') as command: |
442 command.shortDescription = 'Updates translation master files' | 453 command.shortDescription = 'Updates translation master files' |
443 command.description = 'Updates the translation master files in the project on
crowdin.net.' | 454 command.description = 'Updates the translation master files in the project on
crowdin.net.' |
444 command.params = '[options] project-key' | 455 command.params = '[options] project-key' |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 if option in ('-h', '--help'): | 529 if option in ('-h', '--help'): |
519 usage(scriptName, type, command) | 530 usage(scriptName, type, command) |
520 sys.exit() | 531 sys.exit() |
521 commands[command](baseDir, scriptName, opts, args, type) | 532 commands[command](baseDir, scriptName, opts, args, type) |
522 else: | 533 else: |
523 print 'Command %s is not supported for this application type' % command | 534 print 'Command %s is not supported for this application type' % command |
524 usage(scriptName, type) | 535 usage(scriptName, type) |
525 else: | 536 else: |
526 print 'Command %s is unrecognized' % command | 537 print 'Command %s is unrecognized' % command |
527 usage(scriptName, type) | 538 usage(scriptName, type) |
OLD | NEW |