| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Wrappers for gsutil, for basic interaction with Google Cloud Storage.""" | 5 """Wrappers for gsutil, for basic interaction with Google Cloud Storage.""" |
| 6 | 6 |
| 7 import collections | 7 import collections |
| 8 import contextlib | 8 import contextlib |
| 9 import hashlib | 9 import hashlib |
| 10 import logging | 10 import logging |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 BUCKET_ALIASES = collections.OrderedDict(( | 36 BUCKET_ALIASES = collections.OrderedDict(( |
| 37 ('public', PUBLIC_BUCKET), | 37 ('public', PUBLIC_BUCKET), |
| 38 ('partner', PARTNER_BUCKET), | 38 ('partner', PARTNER_BUCKET), |
| 39 ('internal', INTERNAL_BUCKET), | 39 ('internal', INTERNAL_BUCKET), |
| 40 ('output', TELEMETRY_OUTPUT), | 40 ('output', TELEMETRY_OUTPUT), |
| 41 )) | 41 )) |
| 42 | 42 |
| 43 BUCKET_ALIAS_NAMES = BUCKET_ALIASES.keys() | 43 BUCKET_ALIAS_NAMES = BUCKET_ALIASES.keys() |
| 44 | 44 |
| 45 | 45 |
| 46 _GSUTIL_PATH = os.path.join(path.GetTelemetryDir(), 'third_party', 'gsutilz', | 46 _GSUTIL_PATH = os.path.join(util.GetCatapultDir(), 'third_party', 'gsutil', |
| 47 'gsutil') | 47 'gsutil') |
| 48 | 48 |
| 49 # TODO(tbarzic): A workaround for http://crbug.com/386416 and | 49 # TODO(tbarzic): A workaround for http://crbug.com/386416 and |
| 50 # http://crbug.com/359293. See |_RunCommand|. | 50 # http://crbug.com/359293. See |_RunCommand|. |
| 51 _CROS_GSUTIL_HOME_WAR = '/home/chromeos-test/' | 51 _CROS_GSUTIL_HOME_WAR = '/home/chromeos-test/' |
| 52 | 52 |
| 53 | 53 |
| 54 class CloudStorageError(Exception): | 54 class CloudStorageError(Exception): |
| 55 @staticmethod | 55 @staticmethod |
| 56 def _GetConfigInstructions(): | 56 def _GetConfigInstructions(): |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 chunk = f.read(1024*1024) | 342 chunk = f.read(1024*1024) |
| 343 if not chunk: | 343 if not chunk: |
| 344 break | 344 break |
| 345 sha1.update(chunk) | 345 sha1.update(chunk) |
| 346 return sha1.hexdigest() | 346 return sha1.hexdigest() |
| 347 | 347 |
| 348 | 348 |
| 349 def ReadHash(hash_path): | 349 def ReadHash(hash_path): |
| 350 with open(hash_path, 'rb') as f: | 350 with open(hash_path, 'rb') as f: |
| 351 return f.read(1024).rstrip() | 351 return f.read(1024).rstrip() |
| OLD | NEW |