| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 import os | 5 import os |
| 6 import re | 6 import re |
| 7 import sys | 7 import sys |
| 8 | 8 |
| 9 def _GetTelemetryPath(input_api): | 9 def _GetTelemetryPath(input_api): |
| 10 return os.path.join( | 10 return os.path.join( |
| 11 os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname( | 11 os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname( |
| 12 input_api.PresubmitLocalPath())))), 'tools', 'telemetry') | 12 input_api.PresubmitLocalPath())))), 'tools', 'telemetry') |
| 13 | 13 |
| 14 def LoadSupport(input_api): | 14 def LoadSupport(input_api): |
| 15 if 'cloud_storage' not in globals(): | 15 if 'cloud_storage' not in globals(): |
| 16 # Avoid leaking changes to global sys.path. | 16 # Avoid leaking changes to global sys.path. |
| 17 _old_sys_path = sys.path | 17 _old_sys_path = sys.path |
| 18 try: | 18 try: |
| 19 telemetry_path = _GetTelemetryPath(input_api) | 19 telemetry_path = _GetTelemetryPath(input_api) |
| 20 sys.path = [telemetry_path] + sys.path | 20 sys.path = [telemetry_path] + sys.path |
| 21 from telemetry.util import cloud_storage | 21 from catapult_base import cloud_storage |
| 22 globals()['cloud_storage'] = cloud_storage | 22 globals()['cloud_storage'] = cloud_storage |
| 23 finally: | 23 finally: |
| 24 sys.path = _old_sys_path | 24 sys.path = _old_sys_path |
| 25 | 25 |
| 26 return globals()['cloud_storage'] | 26 return globals()['cloud_storage'] |
| 27 | 27 |
| 28 | 28 |
| 29 def _GetFilesNotInCloud(input_api): | 29 def _GetFilesNotInCloud(input_api): |
| 30 """Searches for .sha1 files and checks to see if they have already | 30 """Searches for .sha1 files and checks to see if they have already |
| 31 been uploaded Cloud Storage. Returns a list of those that have not. | 31 been uploaded Cloud Storage. Returns a list of those that have not. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 | 82 |
| 83 def CheckChangeOnUpload(input_api, output_api): | 83 def CheckChangeOnUpload(input_api, output_api): |
| 84 results = _VerifyFilesInCloud(input_api, output_api) | 84 results = _VerifyFilesInCloud(input_api, output_api) |
| 85 return results | 85 return results |
| 86 | 86 |
| 87 | 87 |
| 88 def CheckChangeOnCommit(input_api, output_api): | 88 def CheckChangeOnCommit(input_api, output_api): |
| 89 results = _VerifyFilesInCloud(input_api, output_api) | 89 results = _VerifyFilesInCloud(input_api, output_api) |
| 90 return results | 90 return results |
| OLD | NEW |