| 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 help='A regular expression that is compared against ' | 326 help='A regular expression that is compared against ' |
| 327 'Python\'s sys.platform. If this option is specified, ' | 327 'Python\'s sys.platform. If this option is specified, ' |
| 328 'the download will happen only if there is a match.') | 328 'the download will happen only if there is a match.') |
| 329 parser.add_option('-v', '--verbose', action='store_true', | 329 parser.add_option('-v', '--verbose', action='store_true', |
| 330 help='Output extra diagnostic and progress information.') | 330 help='Output extra diagnostic and progress information.') |
| 331 | 331 |
| 332 (options, args) = parser.parse_args() | 332 (options, args) = parser.parse_args() |
| 333 | 333 |
| 334 # Make sure we should run at all based on platform matching. | 334 # Make sure we should run at all based on platform matching. |
| 335 if options.platform: | 335 if options.platform: |
| 336 if not re.match(options.platform, sys.platform): | 336 if not re.match(options.platform, GetNormalizedPlatform()): |
| 337 if options.verbose: | 337 if options.verbose: |
| 338 print('The current platform doesn\'t match "%s", skipping.' % | 338 print('The current platform doesn\'t match "%s", skipping.' % |
| 339 options.platform) | 339 options.platform) |
| 340 return 0 | 340 return 0 |
| 341 | 341 |
| 342 # Set the boto file to /dev/null if we don't need auth. | 342 # Set the boto file to /dev/null if we don't need auth. |
| 343 if options.no_auth: | 343 if options.no_auth: |
| 344 options.boto = os.devnull | 344 options.boto = os.devnull |
| 345 | 345 |
| 346 # Make sure we can find a working instance of gsutil. | 346 # Make sure we can find a working instance of gsutil. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 return code | 402 return code |
| 403 | 403 |
| 404 return download_from_google_storage( | 404 return download_from_google_storage( |
| 405 input_filename, base_url, gsutil, options.num_threads, options.directory, | 405 input_filename, base_url, gsutil, options.num_threads, options.directory, |
| 406 options.recursive, options.force, options.output, options.ignore_errors, | 406 options.recursive, options.force, options.output, options.ignore_errors, |
| 407 options.sha1_file, options.verbose) | 407 options.sha1_file, options.verbose) |
| 408 | 408 |
| 409 | 409 |
| 410 if __name__ == '__main__': | 410 if __name__ == '__main__': |
| 411 sys.exit(main(sys.argv)) | 411 sys.exit(main(sys.argv)) |
| OLD | NEW |