OLD | NEW |
1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 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 | 5 |
6 def _CommonChecks(input_api, output_api): | 6 def _CommonChecks(input_api, output_api): |
7 results = [] | 7 results = [] |
8 try: | 8 try: |
9 import sys | 9 import sys |
10 old_sys_path = sys.path | 10 old_sys_path = sys.path[:] |
11 cwd = input_api.PresubmitLocalPath() | 11 cwd = input_api.PresubmitLocalPath() |
12 sys.path += [input_api.os_path.join(cwd, '..', '..', 'tools')] | 12 sys.path += [input_api.os_path.join(cwd, '..', '..', 'tools')] |
13 import web_dev_style.presubmit_support | 13 import web_dev_style.presubmit_support |
14 results += web_dev_style.presubmit_support.CheckStyle(input_api, output_api) | 14 results += web_dev_style.presubmit_support.CheckStyle(input_api, output_api) |
15 finally: | 15 finally: |
16 sys.path = old_sys_path | 16 sys.path = old_sys_path |
17 return results | 17 return results |
18 | 18 |
19 | 19 |
20 def CheckChangeOnUpload(input_api, output_api): | 20 def CheckChangeOnUpload(input_api, output_api): |
21 return _CommonChecks(input_api, output_api) | 21 return _CommonChecks(input_api, output_api) |
22 | 22 |
23 | 23 |
24 def CheckChangeOnCommit(input_api, output_api): | 24 def CheckChangeOnCommit(input_api, output_api): |
25 return _CommonChecks(input_api, output_api) | 25 return _CommonChecks(input_api, output_api) |
OLD | NEW |