OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 """Top-level presubmit script for depot tools. | 5 """Top-level presubmit script for depot tools. |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for |
8 details on the presubmit API built into depot_tools. | 8 details on the presubmit API built into depot_tools. |
9 """ | 9 """ |
10 | 10 |
11 | 11 |
12 def CommonChecks(input_api, output_api): | 12 def CommonChecks(input_api, output_api): |
13 results = [] | 13 results = [] |
| 14 import sys |
| 15 if not sys.version.startswith('2.5'): |
| 16 # Depot_tools has the particularity that it needs to be tested on python |
| 17 # 2.5. But we don't want the presubmit check to fail if it is not installed. |
| 18 results.append(output_api.PresubmitNotifyResult( |
| 19 'You should install python 2.5 and run ln -s $(which python2.5) python.' |
| 20 '\n' |
| 21 'A great place to put this symlink is in depot_tools.\n' |
| 22 'Otherwise, you break depot_tools on python 2.5, you get to keep the ' |
| 23 'pieces.')) |
| 24 |
14 | 25 |
15 results.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) | 26 results.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) |
16 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ | 27 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ |
17 r'^cpplint\.py$', | 28 r'^cpplint\.py$', |
18 r'^tests[\/\\]\w+?[\/\\].+'] | 29 r'^tests[\/\\]\w+?[\/\\].+'] |
19 results.extend(input_api.canned_checks.RunPylint( | 30 results.extend(input_api.canned_checks.RunPylint( |
20 input_api, | 31 input_api, |
21 output_api, | 32 output_api, |
22 white_list=[r'.*\.py$', r'^git-try$'], | 33 white_list=[r'.*\.py$', r'^git-try$'], |
23 black_list=black_list)) | 34 black_list=black_list)) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 return CommonChecks(input_api, output_api) | 104 return CommonChecks(input_api, output_api) |
94 | 105 |
95 | 106 |
96 def CheckChangeOnCommit(input_api, output_api): | 107 def CheckChangeOnCommit(input_api, output_api): |
97 output = [] | 108 output = [] |
98 output.extend(CommonChecks(input_api, output_api)) | 109 output.extend(CommonChecks(input_api, output_api)) |
99 output.extend(input_api.canned_checks.CheckDoNotSubmit( | 110 output.extend(input_api.canned_checks.CheckDoNotSubmit( |
100 input_api, | 111 input_api, |
101 output_api)) | 112 output_api)) |
102 return output | 113 return output |
OLD | NEW |