| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 """Returns the result of sys.platform accounting for cygwin. | 48 """Returns the result of sys.platform accounting for cygwin. |
| 49 Under cygwin, this will always return "win32" like the native Python.""" | 49 Under cygwin, this will always return "win32" like the native Python.""" |
| 50 if sys.platform == 'cygwin': | 50 if sys.platform == 'cygwin': |
| 51 return 'win32' | 51 return 'win32' |
| 52 return sys.platform | 52 return sys.platform |
| 53 | 53 |
| 54 # Common utilities | 54 # Common utilities |
| 55 class Gsutil(object): | 55 class Gsutil(object): |
| 56 """Call gsutil with some predefined settings. This is a convenience object, | 56 """Call gsutil with some predefined settings. This is a convenience object, |
| 57 and is also immutable.""" | 57 and is also immutable.""" |
| 58 def __init__(self, path, boto_path=None, timeout=None, version='4.7'): | 58 def __init__(self, path, boto_path=None, timeout=None, version='4.15'): |
| 59 if not os.path.exists(path): | 59 if not os.path.exists(path): |
| 60 raise FileNotFoundError('GSUtil not found in %s' % path) | 60 raise FileNotFoundError('GSUtil not found in %s' % path) |
| 61 self.path = path | 61 self.path = path |
| 62 self.timeout = timeout | 62 self.timeout = timeout |
| 63 self.boto_path = boto_path | 63 self.boto_path = boto_path |
| 64 self.version = version | 64 self.version = version |
| 65 | 65 |
| 66 def get_sub_env(self): | 66 def get_sub_env(self): |
| 67 env = os.environ.copy() | 67 env = os.environ.copy() |
| 68 if self.boto_path == os.devnull: | 68 if self.boto_path == os.devnull: |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 507 |
| 508 return download_from_google_storage( | 508 return download_from_google_storage( |
| 509 input_filename, base_url, gsutil, options.num_threads, options.directory, | 509 input_filename, base_url, gsutil, options.num_threads, options.directory, |
| 510 options.recursive, options.force, options.output, options.ignore_errors, | 510 options.recursive, options.force, options.output, options.ignore_errors, |
| 511 options.sha1_file, options.verbose, options.auto_platform, | 511 options.sha1_file, options.verbose, options.auto_platform, |
| 512 options.extract) | 512 options.extract) |
| 513 | 513 |
| 514 | 514 |
| 515 if __name__ == '__main__': | 515 if __name__ == '__main__': |
| 516 sys.exit(main(sys.argv)) | 516 sys.exit(main(sys.argv)) |
| OLD | NEW |