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

Delta Between Two Patch Sets: build.py

Issue 29562614: Issue 5752 - Removing safari support (Closed)
Left Patch Set: Rebasing, removing additional files Created Oct. 4, 2017, 12:01 p.m.
Right Patch Set: NO CHANGE rebase against #5751 @ Patch Set 7 Created Oct. 10, 2017, 9:28 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | packagerSafari.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
tlucas 2017/10/04 12:04:11 Note: All changes are the result of rebasing
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 import buildtools
11 from getopt import getopt, GetoptError 10 from getopt import getopt, GetoptError
12 from StringIO import StringIO 11 from StringIO import StringIO
13 from zipfile import ZipFile 12 from zipfile import ZipFile
14 13
15 knownTypes = ('gecko-webext', 'chrome', 'generic', 'edge') 14 knownTypes = ('gecko-webext', 'chrome', 'generic', 'edge')
16 15
17 16
18 class Command(object): 17 class Command(object):
19 name = property(lambda self: self._name) 18 name = property(lambda self: self._name)
20 shortDescription = property( 19 shortDescription = property(
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 devenv_dir = getDevEnvPath(baseDir, type) 206 devenv_dir = getDevEnvPath(baseDir, type)
208 207
209 shutil.rmtree(devenv_dir, ignore_errors=True) 208 shutil.rmtree(devenv_dir, ignore_errors=True)
210 209
211 file.seek(0) 210 file.seek(0)
212 with ZipFile(file, 'r') as zip_file: 211 with ZipFile(file, 'r') as zip_file:
213 zip_file.extractall(devenv_dir) 212 zip_file.extractall(devenv_dir)
214 213
215 214
216 def readLocaleConfig(baseDir, type, metadata): 215 def readLocaleConfig(baseDir, type, metadata):
217 if type in {'chrome', 'gecko-webext'}: 216 if type != 'generic':
218 import buildtools.packagerChrome as packager 217 import buildtools.packagerChrome as packager
219 localeDir = os.path.join(baseDir, '_locales') 218 localeDir = os.path.join(baseDir, '_locales')
220 localeConfig = { 219 localeConfig = {
221 'default_locale': packager.defaultLocale, 220 'default_locale': packager.defaultLocale,
222 } 221 }
223 else: 222 else:
224 localeDir = os.path.join( 223 localeDir = os.path.join(
225 baseDir, *metadata.get('locales', 'base_path').split('/') 224 baseDir, *metadata.get('locales', 'base_path').split('/')
226 ) 225 )
227 localeConfig = { 226 localeConfig = {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 key = args[0] 285 key = args[0]
287 286
288 from buildtools.packager import readMetadata 287 from buildtools.packager import readMetadata
289 metadata = readMetadata(baseDir, type) 288 metadata = readMetadata(baseDir, type)
290 289
291 basename = metadata.get('general', 'basename') 290 basename = metadata.get('general', 'basename')
292 localeConfig = readLocaleConfig(baseDir, type, metadata) 291 localeConfig = readLocaleConfig(baseDir, type, metadata)
293 292
294 import buildtools.localeTools as localeTools 293 import buildtools.localeTools as localeTools
295 for locale, localeDir in localeConfig['locales'].iteritems(): 294 for locale, localeDir in localeConfig['locales'].iteritems():
296 if locale != localeConfig['default_locale']: 295 if locale != localeConfig['default_locale'].replace('_', '-'):
297 localeTools.uploadTranslations(localeConfig, metadata, localeDir, lo cale, 296 localeTools.uploadTranslations(localeConfig, metadata, localeDir, lo cale,
298 basename, key) 297 basename, key)
299 298
300 299
301 def getTranslations(baseDir, scriptName, opts, args, type): 300 def getTranslations(baseDir, scriptName, opts, args, type):
302 if len(args) < 1: 301 if len(args) < 1:
303 print 'Project key is required to update translation master files.' 302 print 'Project key is required to update translation master files.'
304 usage(scriptName, type, 'translate') 303 usage(scriptName, type, 'translate')
305 return 304 return
306 305
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 return 371 return
373 372
374 import buildtools.releaseAutomation as releaseAutomation 373 import buildtools.releaseAutomation as releaseAutomation
375 releaseAutomation.run(baseDir, type, version, keyFile, downloadsRepo) 374 releaseAutomation.run(baseDir, type, version, keyFile, downloadsRepo)
376 375
377 376
378 def updatePSL(baseDir, scriptName, opts, args, type): 377 def updatePSL(baseDir, scriptName, opts, args, type):
379 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater 378 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater
380 publicSuffixListUpdater.updatePSL(baseDir) 379 publicSuffixListUpdater.updatePSL(baseDir)
381 380
381
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',))
Vasily Kuznetsov 2017/10/05 20:45:18 Here `types` was a tuple and now became a string.
tlucas 2017/10/06 09:21:54 Done.
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-webext', '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-webext', '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 command.supportedTypes = ('chrome', 'generic')
404 403
405 with addCommand(updateTranslationMaster, 'translate') as command: 404 with addCommand(updateTranslationMaster, 'translate') as command:
406 command.shortDescription = 'Updates translation master files' 405 command.shortDescription = 'Updates translation master files'
407 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.'
408 command.params = '[options] project-key' 407 command.params = '[options] project-key'
409 command.supportedTypes = ('chrome', 'generic')
410 408
411 with addCommand(uploadTranslations, 'uploadtrans') as command: 409 with addCommand(uploadTranslations, 'uploadtrans') as command:
412 command.shortDescription = 'Uploads existing translations' 410 command.shortDescription = 'Uploads existing translations'
413 command.description = 'Uploads already existing translations to the project on crowdin.net.' 411 command.description = 'Uploads already existing translations to the project on crowdin.net.'
414 command.params = '[options] project-key' 412 command.params = '[options] project-key'
415 command.supportedTypes = ('chrome', 'generic')
416 413
417 with addCommand(getTranslations, 'gettranslations') as command: 414 with addCommand(getTranslations, 'gettranslations') as command:
418 command.shortDescription = 'Downloads translation updates' 415 command.shortDescription = 'Downloads translation updates'
419 command.description = 'Downloads updated translations from crowdin.net.' 416 command.description = 'Downloads updated translations from crowdin.net.'
420 command.params = '[options] project-key' 417 command.params = '[options] project-key'
421 command.supportedTypes = ('chrome', 'generic')
422 418
423 with addCommand(generateDocs, 'docs') as command: 419 with addCommand(generateDocs, 'docs') as command:
424 command.shortDescription = 'Generate documentation (requires node.js)' 420 command.shortDescription = 'Generate documentation (requires node.js)'
425 command.description = ('Generate documentation files and write them into ' 421 command.description = ('Generate documentation files and write them into '
426 'the specified directory.') 422 'the specified directory.')
427 command.addOption('Suppress JsDoc output', short='q', long='quiet') 423 command.addOption('Suppress JsDoc output', short='q', long='quiet')
428 command.params = '[options] <directory>' 424 command.params = '[options] <directory>'
429 command.supportedTypes = ('chrome') 425 command.supportedTypes = ('chrome',)
430 426
431 with addCommand(runReleaseAutomation, 'release') as command: 427 with addCommand(runReleaseAutomation, 'release') as command:
432 command.shortDescription = 'Run release automation' 428 command.shortDescription = 'Run release automation'
433 command.description = 'Note: If you are not the project owner then you ' "probably don't want to run this!\n\n" 'Runs release automation: crea tes downloads for the new version, tags ' 'source code repository as well as downloads and buildtools repository.' 429 command.description = 'Note: If you are not the project owner then you ' "probably don't want to run this!\n\n" 'Runs release automation: crea tes downloads for the new version, tags ' 'source code repository as well as downloads and buildtools repository.'
434 command.addOption('File containing private key and certificates required to sign the release.', short='k', long='key', value='file', types=('chrome', 'edge' )) 430 command.addOption('File containing private key and certificates required to sign the release.', short='k', long='key', value='file', types=('chrome', 'edge' ))
435 command.addOption('Directory containing downloads repository (if omitted ../ downloads is assumed)', short='d', long='downloads', value='dir') 431 command.addOption('Directory containing downloads repository (if omitted ../ downloads is assumed)', short='d', long='downloads', value='dir')
436 command.params = '[options] <version>' 432 command.params = '[options] <version>'
437 command.supportedTypes = ('chrome', 'edge') 433 command.supportedTypes = ('chrome', 'edge')
438 434
439 with addCommand(updatePSL, 'updatepsl') as command: 435 with addCommand(updatePSL, 'updatepsl') as command:
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 if option in ('-h', '--help'): 503 if option in ('-h', '--help'):
508 usage(scriptName, type, command) 504 usage(scriptName, type, command)
509 sys.exit() 505 sys.exit()
510 commands[command](baseDir, scriptName, opts, args, type) 506 commands[command](baseDir, scriptName, opts, args, type)
511 else: 507 else:
512 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
513 usage(scriptName, type) 509 usage(scriptName, type)
514 else: 510 else:
515 print 'Command %s is unrecognized' % command 511 print 'Command %s is unrecognized' % command
516 usage(scriptName, type) 512 usage(scriptName, type)
LEFTRIGHT
« no previous file | packagerSafari.py » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld