OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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, tests_to_black_list): | 12 def CommonChecks(input_api, output_api, tests_to_black_list): |
13 results = [] | 13 results = [] |
14 import sys | 14 import sys |
15 if not sys.version.startswith('2.5'): | 15 if not sys.version.startswith('2.5'): |
16 # Depot_tools has the particularity that it needs to be tested on python | 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. | 17 # 2.5. But we don't want the presubmit check to fail if it is not installed. |
18 results.append(output_api.PresubmitNotifyResult( | 18 results.append(output_api.PresubmitNotifyResult( |
19 'You should install python 2.5 and run ln -s $(which python2.5) python.' | 19 'You should install python 2.5 and run ln -s $(which python2.5) python.' |
20 '\n' | 20 '\n' |
21 'A great place to put this symlink is in depot_tools.\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 ' | 22 'Otherwise, you break depot_tools on python 2.5, you get to keep the ' |
23 'pieces.')) | 23 'pieces.')) |
24 | 24 |
25 | 25 |
26 results.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) | 26 results.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) |
27 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ | 27 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ |
28 r'^cpplint\.py$', | 28 r'^cpplint\.py$', |
29 r'^cpplint_chromium\.py$', | 29 r'^cpplint_chromium\.py$', |
30 r'^python_bin[\/\\].+', | 30 r'^python_bin[\/\\].+', |
| 31 r'^site-packages-py[0-9]\.[0-9][\/\\].+', |
31 r'^svn_bin[\/\\].+', | 32 r'^svn_bin[\/\\].+', |
32 r'^testing_support[\/\\]_rietveld[\/\\].+'] | 33 r'^testing_support[\/\\]_rietveld[\/\\].+'] |
33 results.extend(input_api.canned_checks.RunPylint( | 34 results.extend(input_api.canned_checks.RunPylint( |
34 input_api, | 35 input_api, |
35 output_api, | 36 output_api, |
36 white_list=[r'.*\.py$'], | 37 white_list=[r'.*\.py$'], |
37 black_list=black_list)) | 38 black_list=black_list)) |
38 | 39 |
39 # TODO(maruel): Make sure at least one file is modified first. | 40 # TODO(maruel): Make sure at least one file is modified first. |
40 # TODO(maruel): If only tests are modified, only run them. | 41 # TODO(maruel): If only tests are modified, only run them. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 108 |
108 | 109 |
109 def CheckChangeOnCommit(input_api, output_api): | 110 def CheckChangeOnCommit(input_api, output_api): |
110 output = [] | 111 output = [] |
111 output.extend(CommonChecks(input_api, output_api, [])) | 112 output.extend(CommonChecks(input_api, output_api, [])) |
112 output.extend(input_api.canned_checks.CheckDoNotSubmit( | 113 output.extend(input_api.canned_checks.CheckDoNotSubmit( |
113 input_api, | 114 input_api, |
114 output_api)) | 115 output_api)) |
115 output.extend(RunGitClTests(input_api, output_api)) | 116 output.extend(RunGitClTests(input_api, output_api)) |
116 return output | 117 return output |
OLD | NEW |