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

Side by Side Diff: build.py

Issue 29587910: Issue 104 - added checktranslations function
Patch Set: Created Oct. 24, 2017, 11:36 p.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 | localeTools.py » ('j') | localeTools.py » ('J')
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
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 375
376 import buildtools.releaseAutomation as releaseAutomation 376 import buildtools.releaseAutomation as releaseAutomation
377 releaseAutomation.run(baseDir, type, version, keyFile, downloadsRepo) 377 releaseAutomation.run(baseDir, type, version, keyFile, downloadsRepo)
378 378
379 379
380 def updatePSL(baseDir, scriptName, opts, args, type): 380 def updatePSL(baseDir, scriptName, opts, args, type):
381 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater 381 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater
382 publicSuffixListUpdater.updatePSL(baseDir) 382 publicSuffixListUpdater.updatePSL(baseDir)
383 383
384 384
385 def check_translations(baseDir, scriptName, opts, args, type):
386 import buildtools.localeTools as localetools
387 localetools.check_translations(baseDir)
388
389
385 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName, type), ('help', '-h', '--help')) as command: 390 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName, type), ('help', '-h', '--help')) as command:
386 command.shortDescription = 'Show this message' 391 command.shortDescription = 'Show this message'
387 392
388 with addCommand(runBuild, 'build') as command: 393 with addCommand(runBuild, 'build') as command:
389 command.shortDescription = 'Create a build' 394 command.shortDescription = 'Create a build'
390 command.description = 'Creates an extension build with given file name. If o utput_file is missing a default name will be chosen.' 395 command.description = 'Creates an extension build with given file name. If o utput_file is missing a default name will be chosen.'
391 command.params = '[options] [output_file]' 396 command.params = '[options] [output_file]'
392 command.addOption('Use given build number (if omitted the build number will be retrieved from Mercurial)', short='b', long='build', value='num') 397 command.addOption('Use given build number (if omitted the build number will be retrieved from Mercurial)', short='b', long='build', value='num')
393 command.addOption('File containing private key and certificates required to sign the package', short='k', long='key', value='file', types={'chrome'}) 398 command.addOption('File containing private key and certificates required to sign the package', short='k', long='key', value='file', types={'chrome'})
394 command.addOption('Create a release build', short='r', long='release') 399 command.addOption('Create a release build', short='r', long='release')
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 command.addOption('File containing private key and certificates required to sign the release.', short='k', long='key', value='file', types={'chrome', 'edge' }) 438 command.addOption('File containing private key and certificates required to sign the release.', short='k', long='key', value='file', types={'chrome', 'edge' })
434 command.addOption('Directory containing downloads repository (if omitted ../ downloads is assumed)', short='d', long='downloads', value='dir') 439 command.addOption('Directory containing downloads repository (if omitted ../ downloads is assumed)', short='d', long='downloads', value='dir')
435 command.params = '[options] <version>' 440 command.params = '[options] <version>'
436 command.supportedTypes = {'chrome', 'edge'} 441 command.supportedTypes = {'chrome', 'edge'}
437 442
438 with addCommand(updatePSL, 'updatepsl') as command: 443 with addCommand(updatePSL, 'updatepsl') as command:
439 command.shortDescription = 'Updates Public Suffix List' 444 command.shortDescription = 'Updates Public Suffix List'
440 command.description = 'Downloads Public Suffix List (see http://publicsuffix .org/) and generates lib/publicSuffixList.js from it.' 445 command.description = 'Downloads Public Suffix List (see http://publicsuffix .org/) and generates lib/publicSuffixList.js from it.'
441 command.supportedTypes = {'chrome'} 446 command.supportedTypes = {'chrome'}
442 447
448 with addCommand(check_translations, 'checktranslations') as command:
449 command.shortDescription = 'Checks translation files for overlong, missing a nd structure'
tlucas 2017/10/25 15:09:23 nit: this line exceeds 79 characters nit: "Checks
erick 2017/10/29 03:45:54 Acknowledged.
450 command.description = 'JSON files translations will be checked by this funct ionality'
tlucas 2017/10/25 15:09:23 nit: this line exceeds 79 characters nit: descript
erick 2017/10/29 03:45:54 Acknowledged.
451
443 452
444 def getType(baseDir, scriptName, args): 453 def getType(baseDir, scriptName, args):
445 # Look for an explicit type parameter (has to be the first parameter) 454 # Look for an explicit type parameter (has to be the first parameter)
446 if len(args) >= 2 and args[0] == '-t': 455 if len(args) >= 2 and args[0] == '-t':
447 type = args[1] 456 type = args[1]
448 del args[1] 457 del args[1]
449 del args[0] 458 del args[0]
450 if type not in knownTypes: 459 if type not in knownTypes:
451 print ''' 460 print '''
452 Unknown type %s specified, supported types are: %s 461 Unknown type %s specified, supported types are: %s
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 if option in {'-h', '--help'}: 515 if option in {'-h', '--help'}:
507 usage(scriptName, type, command) 516 usage(scriptName, type, command)
508 sys.exit() 517 sys.exit()
509 commands[command](baseDir, scriptName, opts, args, type) 518 commands[command](baseDir, scriptName, opts, args, type)
510 else: 519 else:
511 print 'Command %s is not supported for this application type' % comm and 520 print 'Command %s is not supported for this application type' % comm and
512 usage(scriptName, type) 521 usage(scriptName, type)
513 else: 522 else:
514 print 'Command %s is unrecognized' % command 523 print 'Command %s is unrecognized' % command
515 usage(scriptName, type) 524 usage(scriptName, type)
OLDNEW
« no previous file with comments | « no previous file | localeTools.py » ('j') | localeTools.py » ('J')

Powered by Google App Engine
This is Rietveld