| OLD | NEW | 
|---|
| 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 import buildtools | 10 import buildtools | 
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 417         stderr = process.communicate()[1] | 417         stderr = process.communicate()[1] | 
| 418         retcode = process.poll() | 418         retcode = process.poll() | 
| 419         if retcode: | 419         if retcode: | 
| 420             sys.stderr.write(stderr) | 420             sys.stderr.write(stderr) | 
| 421             raise subprocess.CalledProcessError(command, retcode) | 421             raise subprocess.CalledProcessError(command, retcode) | 
| 422     else: | 422     else: | 
| 423         subprocess.check_call(command) | 423         subprocess.check_call(command) | 
| 424 | 424 | 
| 425 | 425 | 
| 426 def runReleaseAutomation(baseDir, scriptName, opts, args, type): | 426 def runReleaseAutomation(baseDir, scriptName, opts, args, type): | 
| 427     keyFiles = [] | 427     keyFile = None | 
| 428     downloadsRepo = os.path.join(baseDir, '..', 'downloads') | 428     downloadsRepo = os.path.join(baseDir, '..', 'downloads') | 
| 429     for option, value in opts: | 429     for option, value in opts: | 
| 430         if option in ('-k', '--key'): | 430         if option in ('-k', '--key'): | 
| 431             keyFiles.append(value) | 431             keyFile = value | 
| 432         elif option in ('-d', '--downloads'): | 432         elif option in ('-d', '--downloads'): | 
| 433             downloadsRepo = value | 433             downloadsRepo = value | 
| 434 | 434 | 
| 435     if len(args) == 0: | 435     if len(args) == 0: | 
| 436         print 'No version number specified for the release' | 436         print 'No version number specified for the release' | 
| 437         usage(scriptName, type, 'release') | 437         usage(scriptName, type, 'release') | 
| 438         return | 438         return | 
| 439     version = args[0] | 439     version = args[0] | 
| 440     if re.search(r'[^\d\.]', version): | 440     if re.search(r'[^\d\.]', version): | 
| 441         print 'Wrong version number format' | 441         print 'Wrong version number format' | 
| 442         usage(scriptName, type, 'release') | 442         usage(scriptName, type, 'release') | 
| 443         return | 443         return | 
| 444 | 444 | 
| 445     if type == 'chrome' and len(keyFiles) != 2: | 445     if type in {'chrome', 'safari'} and keyFile is None: | 
| 446         print >>sys.stderr, 'Error: wrong number of key files specified, two key
     s (Chrome and Safari) required for the release' | 446         print >>sys.stderr, 'Error: you must specify a key file for this release
     ' | 
| 447         usage(scriptName, type, 'release') | 447         usage(scriptName, type, 'release') | 
| 448         return | 448         return | 
| 449 | 449 | 
| 450     import buildtools.releaseAutomation as releaseAutomation | 450     import buildtools.releaseAutomation as releaseAutomation | 
| 451     releaseAutomation.run(baseDir, type, version, keyFiles, downloadsRepo) | 451     releaseAutomation.run(baseDir, type, version, keyFile, downloadsRepo) | 
| 452 | 452 | 
| 453 | 453 | 
| 454 def updatePSL(baseDir, scriptName, opts, args, type): | 454 def updatePSL(baseDir, scriptName, opts, args, type): | 
| 455     import buildtools.publicSuffixListUpdater as publicSuffixListUpdater | 455     import buildtools.publicSuffixListUpdater as publicSuffixListUpdater | 
| 456     publicSuffixListUpdater.updatePSL(baseDir) | 456     publicSuffixListUpdater.updatePSL(baseDir) | 
| 457 | 457 | 
| 458 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName, 
     type), ('help', '-h', '--help')) as command: | 458 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName, 
     type), ('help', '-h', '--help')) as command: | 
| 459     command.shortDescription = 'Show this message' | 459     command.shortDescription = 'Show this message' | 
| 460 | 460 | 
| 461 with addCommand(runBuild, 'build') as command: | 461 with addCommand(runBuild, 'build') as command: | 
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 515 with addCommand(generateDocs, 'docs') as command: | 515 with addCommand(generateDocs, 'docs') as command: | 
| 516     command.shortDescription = 'Generate documentation (requires node.js)' | 516     command.shortDescription = 'Generate documentation (requires node.js)' | 
| 517     command.description = 'Generate documentation files and write them into the 
     specified directory. This operation requires JsDoc 3 to be installed.' | 517     command.description = 'Generate documentation files and write them into the 
     specified directory. This operation requires JsDoc 3 to be installed.' | 
| 518     command.addOption('Suppress JsDoc output', short='q', long='quiet') | 518     command.addOption('Suppress JsDoc output', short='q', long='quiet') | 
| 519     command.params = '[options] <directory>' | 519     command.params = '[options] <directory>' | 
| 520     command.supportedTypes = ('gecko', 'chrome') | 520     command.supportedTypes = ('gecko', 'chrome') | 
| 521 | 521 | 
| 522 with addCommand(runReleaseAutomation, 'release') as command: | 522 with addCommand(runReleaseAutomation, 'release') as command: | 
| 523     command.shortDescription = 'Run release automation' | 523     command.shortDescription = 'Run release automation' | 
| 524     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.' | 524     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.' | 
| 525     command.addOption('File containing private key and certificates required to 
     sign the release. Note that for Chrome releases this option needs to be specifie
     d twice: first a key to sign Chrome builds, then another to sign the Safari buil
     d.', short='k', long='key', value='file', types=('chrome',)) | 525     command.addOption('File containing private key and certificates required to 
     sign the release.', short='k', long='key', value='file', types=('chrome', 'safar
     i', 'edge')) | 
| 526     command.addOption('Directory containing downloads repository (if omitted ../
     downloads is assumed)', short='d', long='downloads', value='dir') | 526     command.addOption('Directory containing downloads repository (if omitted ../
     downloads is assumed)', short='d', long='downloads', value='dir') | 
| 527     command.params = '[options] <version>' | 527     command.params = '[options] <version>' | 
| 528     command.supportedTypes = ('gecko', 'chrome') | 528     command.supportedTypes = ('gecko', 'chrome', 'safari', 'edge') | 
| 529 | 529 | 
| 530 with addCommand(updatePSL, 'updatepsl') as command: | 530 with addCommand(updatePSL, 'updatepsl') as command: | 
| 531     command.shortDescription = 'Updates Public Suffix List' | 531     command.shortDescription = 'Updates Public Suffix List' | 
| 532     command.description = 'Downloads Public Suffix List (see http://publicsuffix
     .org/) and generates lib/publicSuffixList.js from it.' | 532     command.description = 'Downloads Public Suffix List (see http://publicsuffix
     .org/) and generates lib/publicSuffixList.js from it.' | 
| 533     command.supportedTypes = ('chrome',) | 533     command.supportedTypes = ('chrome',) | 
| 534 | 534 | 
| 535 | 535 | 
| 536 def getType(baseDir, scriptName, args): | 536 def getType(baseDir, scriptName, args): | 
| 537     # Look for an explicit type parameter (has to be the first parameter) | 537     # Look for an explicit type parameter (has to be the first parameter) | 
| 538     if len(args) >= 2 and args[0] == '-t': | 538     if len(args) >= 2 and args[0] == '-t': | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 598                 if option in ('-h', '--help'): | 598                 if option in ('-h', '--help'): | 
| 599                     usage(scriptName, type, command) | 599                     usage(scriptName, type, command) | 
| 600                     sys.exit() | 600                     sys.exit() | 
| 601             commands[command](baseDir, scriptName, opts, args, type) | 601             commands[command](baseDir, scriptName, opts, args, type) | 
| 602         else: | 602         else: | 
| 603             print 'Command %s is not supported for this application type' % comm
     and | 603             print 'Command %s is not supported for this application type' % comm
     and | 
| 604             usage(scriptName, type) | 604             usage(scriptName, type) | 
| 605     else: | 605     else: | 
| 606         print 'Command %s is unrecognized' % command | 606         print 'Command %s is unrecognized' % command | 
| 607         usage(scriptName, type) | 607         usage(scriptName, type) | 
| OLD | NEW | 
|---|