OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 """Top-level presubmit script for Skia. | 6 """Top-level presubmit script for Skia. |
7 | 7 |
8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
9 for more details about the presubmit API built into gcl. | 9 for more details about the presubmit API built into gcl. |
10 """ | 10 """ |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 | 183 |
184 def _CheckLGTMsForPublicAPI(input_api, output_api): | 184 def _CheckLGTMsForPublicAPI(input_api, output_api): |
185 """Check LGTMs for public API changes. | 185 """Check LGTMs for public API changes. |
186 | 186 |
187 For public API files make sure there is an LGTM from the list of owners in | 187 For public API files make sure there is an LGTM from the list of owners in |
188 PUBLIC_API_OWNERS. | 188 PUBLIC_API_OWNERS. |
189 """ | 189 """ |
190 results = [] | 190 results = [] |
191 requires_owner_check = False | 191 requires_owner_check = False |
192 for affected_svn_file in input_api.AffectedFiles(): | 192 for affected_file in input_api.AffectedFiles(): |
193 affected_file_path = affected_svn_file.AbsoluteLocalPath() | 193 affected_file_path = affected_file.LocalPath() |
194 file_path, file_ext = os.path.splitext(affected_file_path) | 194 file_path, file_ext = os.path.splitext(affected_file_path) |
195 # We only care about files that end in .h and are under the include dir. | 195 # We only care about files that end in .h and are under the top-level |
196 if file_ext == '.h' and 'include' in file_path.split(os.path.sep): | 196 # include dir. |
| 197 if file_ext == '.h' and 'include' == file_path.split(os.path.sep)[0]: |
197 requires_owner_check = True | 198 requires_owner_check = True |
198 | 199 |
199 if not requires_owner_check: | 200 if not requires_owner_check: |
200 return results | 201 return results |
201 | 202 |
202 lgtm_from_owner = False | 203 lgtm_from_owner = False |
203 issue = input_api.change.issue | 204 issue = input_api.change.issue |
204 if issue and input_api.rietveld: | 205 if issue and input_api.rietveld: |
205 issue_properties = input_api.rietveld.get_issue_properties( | 206 issue_properties = input_api.rietveld.get_issue_properties( |
206 issue=int(issue), messages=True) | 207 issue=int(issue), messages=True) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 state and an error if it is in 'Closed' state. | 249 state and an error if it is in 'Closed' state. |
249 """ | 250 """ |
250 results = [] | 251 results = [] |
251 results.extend(_CommonChecks(input_api, output_api)) | 252 results.extend(_CommonChecks(input_api, output_api)) |
252 results.extend( | 253 results.extend( |
253 _CheckTreeStatus(input_api, output_api, json_url=( | 254 _CheckTreeStatus(input_api, output_api, json_url=( |
254 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) | 255 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) |
255 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) | 256 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) |
256 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) | 257 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) |
257 return results | 258 return results |
OLD | NEW |