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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 377 if options.auto_platform: | 377 if options.auto_platform: |
| 378 parser.error('--platform can not be specified with --auto_platform') | 378 parser.error('--platform can not be specified with --auto_platform') |
| 379 if not re.match(options.platform, GetNormalizedPlatform()): | 379 if not re.match(options.platform, GetNormalizedPlatform()): |
| 380 if options.verbose: | 380 if options.verbose: |
| 381 print('The current platform doesn\'t match "%s", skipping.' % | 381 print('The current platform doesn\'t match "%s", skipping.' % |
| 382 options.platform) | 382 options.platform) |
| 383 return 0 | 383 return 0 |
| 384 | 384 |
| 385 # Set the boto file to /dev/null if we don't need auth. | 385 # Set the boto file to /dev/null if we don't need auth. |
| 386 if options.no_auth: | 386 if options.no_auth: |
| 387 options.boto = os.devnull | 387 if (os.environ.get('BOTO_CONFIG') and not |
| 388 os.environ.get('NO_AUTH_BOTO_CONFIG')): | |
|
hinoka
2015/01/14 18:50:15
Lets only trigger this if proxy settings are detec
Michael Moss
2015/01/14 20:04:05
Everyone exports BOTO_CONFIG? The case I'm concern
| |
| 389 print >> sys.stderr, ('NOTICE: You have BOTO_CONFIG set in your ' | |
| 390 'environment, but the "--no_auth" flag prevents ' | |
| 391 'it from being used.\n' | |
|
hinoka
2015/01/14 18:50:15
Split this into two print statements. '\n' isn't t
Michael Moss
2015/01/14 21:05:44
Done.
| |
| 392 'If you need boto configs even when using ' | |
| 393 '--no_auth (e.g. proxy settings), export your ' | |
| 394 'BOTO_CONFIG as NO_AUTH_BOTO_CONFIG instead.') | |
|
hinoka
2015/01/14 18:50:15
s/instead/also/
Michael Moss
2015/01/14 21:05:44
Done.
| |
| 395 options.boto = os.environ.get('NO_AUTH_BOTO_CONFIG', os.devnull) | |
| 388 | 396 |
| 389 # Make sure gsutil exists where we expect it to. | 397 # Make sure gsutil exists where we expect it to. |
| 390 if os.path.exists(GSUTIL_DEFAULT_PATH): | 398 if os.path.exists(GSUTIL_DEFAULT_PATH): |
| 391 gsutil = Gsutil(GSUTIL_DEFAULT_PATH, | 399 gsutil = Gsutil(GSUTIL_DEFAULT_PATH, |
| 392 boto_path=options.boto) | 400 boto_path=options.boto) |
| 393 else: | 401 else: |
| 394 parser.error('gsutil not found in %s, bad depot_tools checkout?' % | 402 parser.error('gsutil not found in %s, bad depot_tools checkout?' % |
| 395 GSUTIL_DEFAULT_PATH) | 403 GSUTIL_DEFAULT_PATH) |
| 396 | 404 |
| 397 # Passing in -g/--config will run our copy of GSUtil, then quit. | 405 # Passing in -g/--config will run our copy of GSUtil, then quit. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 return code | 458 return code |
| 451 | 459 |
| 452 return download_from_google_storage( | 460 return download_from_google_storage( |
| 453 input_filename, base_url, gsutil, options.num_threads, options.directory, | 461 input_filename, base_url, gsutil, options.num_threads, options.directory, |
| 454 options.recursive, options.force, options.output, options.ignore_errors, | 462 options.recursive, options.force, options.output, options.ignore_errors, |
| 455 options.sha1_file, options.verbose, options.auto_platform) | 463 options.sha1_file, options.verbose, options.auto_platform) |
| 456 | 464 |
| 457 | 465 |
| 458 if __name__ == '__main__': | 466 if __name__ == '__main__': |
| 459 sys.exit(main(sys.argv)) | 467 sys.exit(main(sys.argv)) |
| OLD | NEW |