| OLD | NEW |
| 1 # Copyright (c) 2012 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 import fnmatch | 11 import fnmatch |
| 12 import os | 12 import os |
| 13 | 13 |
| 14 | 14 |
| 15 def CommonChecks(input_api, output_api, tests_to_black_list): | 15 def CommonChecks(input_api, output_api, tests_to_black_list): |
| 16 results = [] | 16 results = [] |
| 17 results.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) | 17 results.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) |
| 18 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ | 18 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ |
| 19 r'^\.recipe_deps[\/\\].*', | 19 r'^\.recipe_deps[\/\\].*', |
| 20 r'^infra[\/\\]\.recipe_deps[\/\\].*', | 20 r'^infra[\/\\]\.recipe_deps[\/\\].*', |
| 21 r'^cpplint\.py$', | 21 r'^cpplint\.py$', |
| 22 r'^cpplint_chromium\.py$', | 22 r'^cpplint_chromium\.py$', |
| 23 r'^external_bin[\/\\].+', | 23 r'^external_bin[\/\\].+', |
| 24 r'^python[0-9]*_bin[\/\\].+', | 24 r'^python[0-9]*_bin[\/\\].+', |
| 25 r'^recipes\.py$', | 25 r'^recipes\.py$', |
| 26 r'^site-packages-py[0-9]\.[0-9][\/\\].+', | 26 r'^site-packages-py[0-9]\.[0-9][\/\\].+', |
| 27 r'^svn_bin[\/\\].+', | 27 r'^svn_bin[\/\\].+', |
| 28 r'^testing_support[\/\\]_rietveld[\/\\].+'] | 28 r'^testing_support[\/\\]_rietveld[\/\\].+', |
| 29 r'^testing_support[\/\\]_infra[\/\\].+', |
| 30 ] |
| 29 if os.path.exists('.gitignore'): | 31 if os.path.exists('.gitignore'): |
| 30 with open('.gitignore') as fh: | 32 with open('.gitignore') as fh: |
| 31 lines = [l.strip() for l in fh.readlines()] | 33 lines = [l.strip() for l in fh.readlines()] |
| 32 black_list.extend([fnmatch.translate(l) for l in lines if | 34 black_list.extend([fnmatch.translate(l) for l in lines if |
| 33 l and not l.startswith('#')]) | 35 l and not l.startswith('#')]) |
| 34 if os.path.exists('.git/info/exclude'): | 36 if os.path.exists('.git/info/exclude'): |
| 35 with open('.git/info/exclude') as fh: | 37 with open('.git/info/exclude') as fh: |
| 36 lines = [l.strip() for l in fh.readlines()] | 38 lines = [l.strip() for l in fh.readlines()] |
| 37 black_list.extend([fnmatch.translate(l) for l in lines if | 39 black_list.extend([fnmatch.translate(l) for l in lines if |
| 38 l and not l.startswith('#')]) | 40 l and not l.startswith('#')]) |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 126 |
| 125 | 127 |
| 126 def CheckChangeOnCommit(input_api, output_api): | 128 def CheckChangeOnCommit(input_api, output_api): |
| 127 output = [] | 129 output = [] |
| 128 output.extend(CommonChecks(input_api, output_api, [])) | 130 output.extend(CommonChecks(input_api, output_api, [])) |
| 129 output.extend(input_api.canned_checks.CheckDoNotSubmit( | 131 output.extend(input_api.canned_checks.CheckDoNotSubmit( |
| 130 input_api, | 132 input_api, |
| 131 output_api)) | 133 output_api)) |
| 132 output.extend(RunGitClTests(input_api, output_api)) | 134 output.extend(RunGitClTests(input_api, output_api)) |
| 133 return output | 135 return output |
| OLD | NEW |