Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: build.py

Issue 29572692: Issue 5845 - Renaming gecko-webext to gecko (Closed)
Patch Set: Removed another webext occurrence Created Oct. 11, 2017, 11:36 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | packagerChrome.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 from StringIO import StringIO 11 from StringIO import StringIO
12 from zipfile import ZipFile 12 from zipfile import ZipFile
13 13
14 knownTypes = ('gecko-webext', 'chrome', 'generic', 'edge') 14 knownTypes = ('gecko', 'chrome', 'generic', 'edge')
15 15
16 16
17 class Command(object): 17 class Command(object):
18 name = property(lambda self: self._name) 18 name = property(lambda self: self._name)
19 shortDescription = property( 19 shortDescription = property(
20 lambda self: self._shortDescription, 20 lambda self: self._shortDescription,
21 lambda self, value: self.__dict__.update({'_shortDescription': value}) 21 lambda self, value: self.__dict__.update({'_shortDescription': value})
22 ) 22 )
23 description = property( 23 description = property(
24 lambda self: self._description, 24 lambda self: self._description,
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 'description': description, 172 'description': description,
173 'options': '\n'.join(options) 173 'options': '\n'.join(options)
174 } 174 }
175 175
176 176
177 def runBuild(baseDir, scriptName, opts, args, type): 177 def runBuild(baseDir, scriptName, opts, args, type):
178 kwargs = {} 178 kwargs = {}
179 for option, value in opts: 179 for option, value in opts:
180 if option in {'-b', '--build'}: 180 if option in {'-b', '--build'}:
181 kwargs['buildNum'] = value 181 kwargs['buildNum'] = value
182 if type != 'gecko-webext' and not kwargs['buildNum'].isdigit(): 182 if type != 'gecko' and not kwargs['buildNum'].isdigit():
183 raise TypeError('Build number must be numerical') 183 raise TypeError('Build number must be numerical')
184 elif option in {'-k', '--key'}: 184 elif option in {'-k', '--key'}:
185 kwargs['keyFile'] = value 185 kwargs['keyFile'] = value
186 elif option in {'-r', '--release'}: 186 elif option in {'-r', '--release'}:
187 kwargs['releaseBuild'] = True 187 kwargs['releaseBuild'] = True
188 if len(args) > 0: 188 if len(args) > 0:
189 kwargs['outFile'] = args[0] 189 kwargs['outFile'] = args[0]
190 190
191 if type in {'chrome', 'gecko-webext'}: 191 if type in {'chrome', 'gecko'}:
192 import buildtools.packagerChrome as packager 192 import buildtools.packagerChrome as packager
193 elif type == 'edge': 193 elif type == 'edge':
194 import buildtools.packagerEdge as packager 194 import buildtools.packagerEdge as packager
195 195
196 packager.createBuild(baseDir, type=type, **kwargs) 196 packager.createBuild(baseDir, type=type, **kwargs)
197 197
198 198
199 def createDevEnv(baseDir, scriptName, opts, args, type): 199 def createDevEnv(baseDir, scriptName, opts, args, type):
200 import buildtools.packagerChrome as packager 200 import buildtools.packagerChrome as packager
201 201
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName, type), ('help', '-h', '--help')) as command: 382 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName, type), ('help', '-h', '--help')) as command:
383 command.shortDescription = 'Show this message' 383 command.shortDescription = 'Show this message'
384 384
385 with addCommand(runBuild, 'build') as command: 385 with addCommand(runBuild, 'build') as command:
386 command.shortDescription = 'Create a build' 386 command.shortDescription = 'Create a build'
387 command.description = 'Creates an extension build with given file name. If o utput_file is missing a default name will be chosen.' 387 command.description = 'Creates an extension build with given file name. If o utput_file is missing a default name will be chosen.'
388 command.params = '[options] [output_file]' 388 command.params = '[options] [output_file]'
389 command.addOption('Use given build number (if omitted the build number will be retrieved from Mercurial)', short='b', long='build', value='num') 389 command.addOption('Use given build number (if omitted the build number will be retrieved from Mercurial)', short='b', long='build', value='num')
390 command.addOption('File containing private key and certificates required to sign the package', short='k', long='key', value='file', types=('chrome',)) 390 command.addOption('File containing private key and certificates required to sign the package', short='k', long='key', value='file', types=('chrome',))
391 command.addOption('Create a release build', short='r', long='release') 391 command.addOption('Create a release build', short='r', long='release')
392 command.supportedTypes = ('gecko-webext', 'chrome', 'edge') 392 command.supportedTypes = ('gecko', 'chrome', 'edge')
393 393
394 with addCommand(createDevEnv, 'devenv') as command: 394 with addCommand(createDevEnv, 'devenv') as command:
395 command.shortDescription = 'Set up a development environment' 395 command.shortDescription = 'Set up a development environment'
396 command.description = 'Will set up or update the devenv folder as an unpacke d extension folder for development.' 396 command.description = 'Will set up or update the devenv folder as an unpacke d extension folder for development.'
397 command.supportedTypes = ('gecko-webext', 'chrome') 397 command.supportedTypes = ('gecko', 'chrome')
398 398
399 with addCommand(setupTranslations, 'setuptrans') as command: 399 with addCommand(setupTranslations, 'setuptrans') as command:
400 command.shortDescription = 'Sets up translation languages' 400 command.shortDescription = 'Sets up translation languages'
401 command.description = 'Sets up translation languages for the project on crow din.net.' 401 command.description = 'Sets up translation languages for the project on crow din.net.'
402 command.params = '[options] project-key' 402 command.params = '[options] project-key'
403 403
404 with addCommand(updateTranslationMaster, 'translate') as command: 404 with addCommand(updateTranslationMaster, 'translate') as command:
405 command.shortDescription = 'Updates translation master files' 405 command.shortDescription = 'Updates translation master files'
406 command.description = 'Updates the translation master files in the project o n crowdin.net.' 406 command.description = 'Updates the translation master files in the project o n crowdin.net.'
407 command.params = '[options] project-key' 407 command.params = '[options] project-key'
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 if option in ('-h', '--help'): 503 if option in ('-h', '--help'):
504 usage(scriptName, type, command) 504 usage(scriptName, type, command)
505 sys.exit() 505 sys.exit()
506 commands[command](baseDir, scriptName, opts, args, type) 506 commands[command](baseDir, scriptName, opts, args, type)
507 else: 507 else:
508 print 'Command %s is not supported for this application type' % comm and 508 print 'Command %s is not supported for this application type' % comm and
509 usage(scriptName, type) 509 usage(scriptName, type)
510 else: 510 else:
511 print 'Command %s is unrecognized' % command 511 print 'Command %s is unrecognized' % command
512 usage(scriptName, type) 512 usage(scriptName, type)
OLDNEW
« no previous file with comments | « no previous file | packagerChrome.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld