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 sys | 5 import sys |
6 | 6 |
7 | 7 |
8 def _GetChromiumSrcDir(input_api): | 8 def _GetChromiumSrcDir(input_api): |
9 return input_api.os_path.abspath(input_api.os_path.join( | 9 return input_api.os_path.abspath(input_api.os_path.join( |
10 input_api.PresubmitLocalPath(), '..', '..', '..', '..')) | 10 input_api.PresubmitLocalPath(), '..', '..', '..', '..')) |
11 | 11 |
12 | 12 |
13 def LoadSupport(input_api): | 13 def LoadSupport(input_api): |
14 if 'cloud_storage' not in globals(): | 14 if 'cloud_storage' not in globals(): |
15 # Avoid leaking changes to global sys.path. | 15 # Avoid leaking changes to global sys.path. |
16 _old_sys_path = sys.path | 16 _old_sys_path = sys.path |
17 try: | 17 try: |
18 catapult_base_path = input_api.os_path.join( | 18 catapult_base_path = input_api.os_path.join( |
19 _GetChromiumSrcDir(input_api), 'third_party', 'catapult', | 19 _GetChromiumSrcDir(input_api), 'third_party', 'catapult', |
20 'catapult_base') | 20 'catapult_base') |
21 sys.path = [catapult_base_path] + sys.path | 21 sys.path = [catapult_base_path] + sys.path |
22 from catapult_base import cloud_storage # pylint: disable=import-error | 22 from catapult_base import cloud_storage |
23 globals()['cloud_storage'] = cloud_storage | 23 globals()['cloud_storage'] = cloud_storage |
24 finally: | 24 finally: |
25 sys.path = _old_sys_path | 25 sys.path = _old_sys_path |
26 | 26 |
27 return globals()['cloud_storage'] | 27 return globals()['cloud_storage'] |
28 | 28 |
29 | 29 |
30 def _GetFilesNotInCloud(input_api): | 30 def _GetFilesNotInCloud(input_api): |
31 """Searches for .sha1 files and checks to see if they have already | 31 """Searches for .sha1 files and checks to see if they have already |
32 been uploaded Cloud Storage. Returns a list of those that have not. | 32 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... |
82 | 82 |
83 | 83 |
84 def CheckChangeOnUpload(input_api, output_api): | 84 def CheckChangeOnUpload(input_api, output_api): |
85 results = _VerifyFilesInCloud(input_api, output_api) | 85 results = _VerifyFilesInCloud(input_api, output_api) |
86 return results | 86 return results |
87 | 87 |
88 | 88 |
89 def CheckChangeOnCommit(input_api, output_api): | 89 def CheckChangeOnCommit(input_api, output_api): |
90 results = _VerifyFilesInCloud(input_api, output_api) | 90 results = _VerifyFilesInCloud(input_api, output_api) |
91 return results | 91 return results |
OLD | NEW |