Chromium Code Reviews| 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 Chromium. | 5 """Top-level presubmit script for Chromium. |
| 6 | 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 8 for more details about the presubmit API built into gcl. | 8 for more details about the presubmit API built into gcl. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 input_api.logging.info('No author, skipping AUTHOR check') | 104 input_api.logging.info('No author, skipping AUTHOR check') |
| 105 return [] | 105 return [] |
| 106 authors_path = input_api.os_path.join( | 106 authors_path = input_api.os_path.join( |
| 107 input_api.PresubmitLocalPath(), 'AUTHORS') | 107 input_api.PresubmitLocalPath(), 'AUTHORS') |
| 108 valid_authors = ( | 108 valid_authors = ( |
| 109 input_api.re.match(r'[^#]+\s+\<(.+?)\>\s*$', line) | 109 input_api.re.match(r'[^#]+\s+\<(.+?)\>\s*$', line) |
| 110 for line in open(authors_path)) | 110 for line in open(authors_path)) |
| 111 valid_authors = [item.group(1).lower() for item in valid_authors if item] | 111 valid_authors = [item.group(1).lower() for item in valid_authors if item] |
| 112 if input_api.verbose: | 112 if input_api.verbose: |
| 113 print 'Valid authors are %s' % ', '.join(valid_authors) | 113 print 'Valid authors are %s' % ', '.join(valid_authors) |
| 114 if not any( | 114 if not any(fnmatch.fnmatch(author.lower(), valid) for valid in valid_authors): |
|
Dirk Pranke
2011/06/14 17:44:27
why is this fnmatch? authors aren't filenames ...
M-A Ruel
2011/06/14 18:06:30
Yes but using wildcards is *much* easier than usin
| |
| 115 True for valid in valid_authors | |
| 116 if fnmatch.fnmatch(author.lower(), valid)): | |
| 117 return [output_api.PresubmitPromptWarning( | 115 return [output_api.PresubmitPromptWarning( |
| 118 ('%s is not in AUTHORS file. If you are a new contributor, please visit' | 116 ('%s is not in AUTHORS file. If you are a new contributor, please visit' |
| 119 '\n' | 117 '\n' |
| 120 'http://www.chromium.org/developers/contributing-code and read the ' | 118 'http://www.chromium.org/developers/contributing-code and read the ' |
| 121 '"Legal" section\n' | 119 '"Legal" section\n' |
| 122 'If you are a chromite, verify the contributor signed the CLA.') % | 120 'If you are a chromite, verify the contributor signed the CLA.') % |
| 123 author)] | 121 author)] |
| 124 return [] | 122 return [] |
| 125 | 123 |
| 126 | 124 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 148 results.extend(input_api.canned_checks.CheckChangeHasBugField( | 146 results.extend(input_api.canned_checks.CheckChangeHasBugField( |
| 149 input_api, output_api)) | 147 input_api, output_api)) |
| 150 results.extend(input_api.canned_checks.CheckChangeHasTestField( | 148 results.extend(input_api.canned_checks.CheckChangeHasTestField( |
| 151 input_api, output_api)) | 149 input_api, output_api)) |
| 152 results.extend(_CheckSubversionConfig(input_api, output_api)) | 150 results.extend(_CheckSubversionConfig(input_api, output_api)) |
| 153 return results | 151 return results |
| 154 | 152 |
| 155 | 153 |
| 156 def GetPreferredTrySlaves(): | 154 def GetPreferredTrySlaves(): |
| 157 return ['win', 'linux', 'mac'] | 155 return ['win', 'linux', 'mac'] |
| OLD | NEW |