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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 # Check if output file already exists. | 448 # Check if output file already exists. |
449 if not options.directory and not options.force and not options.no_resume: | 449 if not options.directory and not options.force and not options.no_resume: |
450 if os.path.exists(options.output): | 450 if os.path.exists(options.output): |
451 parser.error('Output file %s exists and --no_resume is specified.' | 451 parser.error('Output file %s exists and --no_resume is specified.' |
452 % options.output) | 452 % options.output) |
453 | 453 |
454 base_url = 'gs://%s' % options.bucket | 454 base_url = 'gs://%s' % options.bucket |
455 | 455 |
456 # Check we have a valid bucket with valid permissions. | 456 # Check we have a valid bucket with valid permissions. |
457 if not options.no_auth: | 457 if not options.no_auth: |
458 code = check_bucket_permissions(base_url, gsutil, options.no_auth) | 458 code = check_bucket_permissions(base_url, gsutil) |
459 if code: | 459 if code: |
460 return code | 460 return code |
461 | 461 |
462 return download_from_google_storage( | 462 return download_from_google_storage( |
463 input_filename, base_url, gsutil, options.num_threads, options.directory, | 463 input_filename, base_url, gsutil, options.num_threads, options.directory, |
464 options.recursive, options.force, options.output, options.ignore_errors, | 464 options.recursive, options.force, options.output, options.ignore_errors, |
465 options.sha1_file, options.verbose, options.auto_platform) | 465 options.sha1_file, options.verbose, options.auto_platform) |
466 | 466 |
467 | 467 |
468 if __name__ == '__main__': | 468 if __name__ == '__main__': |
469 sys.exit(main(sys.argv)) | 469 sys.exit(main(sys.argv)) |
OLD | NEW |