Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Download files from Google Storage based on SHA1 sums.""" | 6 """Download files from Google Storage based on SHA1 sums.""" |
| 7 | 7 |
| 8 | 8 |
| 9 import hashlib | 9 import hashlib |
| 10 import optparse | 10 import optparse |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 parser.add_option('-p', '--platform', | 351 parser.add_option('-p', '--platform', |
| 352 help='A regular expression that is compared against ' | 352 help='A regular expression that is compared against ' |
| 353 'Python\'s sys.platform. If this option is specified, ' | 353 'Python\'s sys.platform. If this option is specified, ' |
| 354 'the download will happen only if there is a match.') | 354 'the download will happen only if there is a match.') |
| 355 parser.add_option('-a', '--auto_platform', | 355 parser.add_option('-a', '--auto_platform', |
| 356 action='store_true', | 356 action='store_true', |
| 357 help='Detects if any parent folder of the target matches ' | 357 help='Detects if any parent folder of the target matches ' |
| 358 '(linux|mac|win). If so, the script will only ' | 358 '(linux|mac|win). If so, the script will only ' |
| 359 'process files that are in the paths that ' | 359 'process files that are in the paths that ' |
| 360 'that matches the current platform.') | 360 'that matches the current platform.') |
| 361 parser.add_option('-v', '--verbose', action='store_true', | 361 parser.add_option('-v', '--verbose', action='store_true', default=True, |
| 362 help='Output extra diagnostic and progress information.') | 362 help='DEPRECATED: Defaults to True. Use --no-verbose ' |
| 363 'to suppress.') | |
| 364 parser.add_option('--no-verbose', action='store_false', dest='verbose', | |
|
friedman1
2015/07/06 18:31:04
-q, --quiet instead? and then remove the deprecat
| |
| 365 help='Suppresses diagnostic and progress information.') | |
| 363 | 366 |
| 364 (options, args) = parser.parse_args() | 367 (options, args) = parser.parse_args() |
| 365 | 368 |
| 366 # Make sure we should run at all based on platform matching. | 369 # Make sure we should run at all based on platform matching. |
| 367 if options.platform: | 370 if options.platform: |
| 368 if options.auto_platform: | 371 if options.auto_platform: |
| 369 parser.error('--platform can not be specified with --auto_platform') | 372 parser.error('--platform can not be specified with --auto_platform') |
| 370 if not re.match(options.platform, GetNormalizedPlatform()): | 373 if not re.match(options.platform, GetNormalizedPlatform()): |
| 371 if options.verbose: | 374 if options.verbose: |
| 372 print('The current platform doesn\'t match "%s", skipping.' % | 375 print('The current platform doesn\'t match "%s", skipping.' % |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 449 base_url = 'gs://%s' % options.bucket | 452 base_url = 'gs://%s' % options.bucket |
| 450 | 453 |
| 451 return download_from_google_storage( | 454 return download_from_google_storage( |
| 452 input_filename, base_url, gsutil, options.num_threads, options.directory, | 455 input_filename, base_url, gsutil, options.num_threads, options.directory, |
| 453 options.recursive, options.force, options.output, options.ignore_errors, | 456 options.recursive, options.force, options.output, options.ignore_errors, |
| 454 options.sha1_file, options.verbose, options.auto_platform) | 457 options.sha1_file, options.verbose, options.auto_platform) |
| 455 | 458 |
| 456 | 459 |
| 457 if __name__ == '__main__': | 460 if __name__ == '__main__': |
| 458 sys.exit(main(sys.argv)) | 461 sys.exit(main(sys.argv)) |
| OLD | NEW |