Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: download_from_google_storage.py

Issue 1747443002: Remove --no_resume from download_from_google_storage.py (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 parser.add_option('-o', '--output', 367 parser.add_option('-o', '--output',
368 help='Specify the output file name. Defaults to: ' 368 help='Specify the output file name. Defaults to: '
369 '(a) Given a SHA1 hash, the name is the SHA1 hash. ' 369 '(a) Given a SHA1 hash, the name is the SHA1 hash. '
370 '(b) Given a .sha1 file or directory, the name will ' 370 '(b) Given a .sha1 file or directory, the name will '
371 'match (.*).sha1.') 371 'match (.*).sha1.')
372 parser.add_option('-b', '--bucket', 372 parser.add_option('-b', '--bucket',
373 help='Google Storage bucket to fetch from.') 373 help='Google Storage bucket to fetch from.')
374 parser.add_option('-e', '--boto', 374 parser.add_option('-e', '--boto',
375 help='Specify a custom boto file.') 375 help='Specify a custom boto file.')
376 parser.add_option('-c', '--no_resume', action='store_true', 376 parser.add_option('-c', '--no_resume', action='store_true',
377 help='Resume download if file is partially downloaded.') 377 help='DEPRECATED: Resume download if file is '
378 'partially downloaded.')
378 parser.add_option('-f', '--force', action='store_true', 379 parser.add_option('-f', '--force', action='store_true',
379 help='Force download even if local file exists.') 380 help='Force download even if local file exists.')
380 parser.add_option('-i', '--ignore_errors', action='store_true', 381 parser.add_option('-i', '--ignore_errors', action='store_true',
381 help='Don\'t throw error if we find an invalid .sha1 file.') 382 help='Don\'t throw error if we find an invalid .sha1 file.')
382 parser.add_option('-r', '--recursive', action='store_true', 383 parser.add_option('-r', '--recursive', action='store_true',
383 help='Scan folders recursively for .sha1 files. ' 384 help='Scan folders recursively for .sha1 files. '
384 'Must be used with -d/--directory') 385 'Must be used with -d/--directory')
385 parser.add_option('-t', '--num_threads', default=1, type='int', 386 parser.add_option('-t', '--num_threads', default=1, type='int',
386 help='Number of downloader threads to run.') 387 help='Number of downloader threads to run.')
387 parser.add_option('-d', '--directory', action='store_true', 388 parser.add_option('-d', '--directory', action='store_true',
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 # Target is a .sha1 file. 494 # Target is a .sha1 file.
494 if not input_filename.endswith('.sha1'): 495 if not input_filename.endswith('.sha1'):
495 parser.error('--sha1_file is specified, but the input filename ' 496 parser.error('--sha1_file is specified, but the input filename '
496 'does not end with .sha1, and no --output is specified. ' 497 'does not end with .sha1, and no --output is specified. '
497 'Either make sure the input filename has a .sha1 ' 498 'Either make sure the input filename has a .sha1 '
498 'extension, or specify --output.') 499 'extension, or specify --output.')
499 options.output = input_filename[:-5] 500 options.output = input_filename[:-5]
500 else: 501 else:
501 parser.error('Unreachable state.') 502 parser.error('Unreachable state.')
502 503
503 # Check if output file already exists.
504 if not options.directory and not options.force and not options.no_resume:
505 if os.path.exists(options.output):
506 parser.error('Output file %s exists and --no_resume is specified.'
507 % options.output)
508
509 base_url = 'gs://%s' % options.bucket 504 base_url = 'gs://%s' % options.bucket
510 505
511 return download_from_google_storage( 506 return download_from_google_storage(
512 input_filename, base_url, gsutil, options.num_threads, options.directory, 507 input_filename, base_url, gsutil, options.num_threads, options.directory,
513 options.recursive, options.force, options.output, options.ignore_errors, 508 options.recursive, options.force, options.output, options.ignore_errors,
514 options.sha1_file, options.verbose, options.auto_platform, 509 options.sha1_file, options.verbose, options.auto_platform,
515 options.extract) 510 options.extract)
516 511
517 512
518 if __name__ == '__main__': 513 if __name__ == '__main__':
519 sys.exit(main(sys.argv)) 514 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698