| 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 (set(('http_proxy', 'https_proxy')).intersection( |
| 388 env.lower() for env in os.environ) and |
| 389 'NO_AUTH_BOTO_CONFIG' not in os.environ): |
| 390 print >> sys.stderr, ('NOTICE: You have PROXY values set in your ' |
| 391 'environment, but gsutil in depot_tools does not ' |
| 392 '(yet) obey them.') |
| 393 print >> sys.stderr, ('Also, --no_auth prevents the normal BOTO_CONFIG ' |
| 394 'environment variable from being used.') |
| 395 print >> sys.stderr, ('To use a proxy in this situation, please supply ' |
| 396 'those settings in a .boto file pointed to by ' |
| 397 'the NO_AUTH_BOTO_CONFIG environment var.') |
| 398 options.boto = os.environ.get('NO_AUTH_BOTO_CONFIG', os.devnull) |
| 388 | 399 |
| 389 # Make sure gsutil exists where we expect it to. | 400 # Make sure gsutil exists where we expect it to. |
| 390 if os.path.exists(GSUTIL_DEFAULT_PATH): | 401 if os.path.exists(GSUTIL_DEFAULT_PATH): |
| 391 gsutil = Gsutil(GSUTIL_DEFAULT_PATH, | 402 gsutil = Gsutil(GSUTIL_DEFAULT_PATH, |
| 392 boto_path=options.boto) | 403 boto_path=options.boto) |
| 393 else: | 404 else: |
| 394 parser.error('gsutil not found in %s, bad depot_tools checkout?' % | 405 parser.error('gsutil not found in %s, bad depot_tools checkout?' % |
| 395 GSUTIL_DEFAULT_PATH) | 406 GSUTIL_DEFAULT_PATH) |
| 396 | 407 |
| 397 # Passing in -g/--config will run our copy of GSUtil, then quit. | 408 # 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 | 461 return code |
| 451 | 462 |
| 452 return download_from_google_storage( | 463 return download_from_google_storage( |
| 453 input_filename, base_url, gsutil, options.num_threads, options.directory, | 464 input_filename, base_url, gsutil, options.num_threads, options.directory, |
| 454 options.recursive, options.force, options.output, options.ignore_errors, | 465 options.recursive, options.force, options.output, options.ignore_errors, |
| 455 options.sha1_file, options.verbose, options.auto_platform) | 466 options.sha1_file, options.verbose, options.auto_platform) |
| 456 | 467 |
| 457 | 468 |
| 458 if __name__ == '__main__': | 469 if __name__ == '__main__': |
| 459 sys.exit(main(sys.argv)) | 470 sys.exit(main(sys.argv)) |
| OLD | NEW |