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 """Presubmit script for changes affecting extensions. | 5 """Presubmit script for changes affecting extensions. |
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 import fnmatch | 10 import fnmatch |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 fnmatch.fnmatch(name, '*%s*' % ARTICLES_PATH)): | 82 fnmatch.fnmatch(name, '*%s*' % ARTICLES_PATH)): |
83 contents = input_api.ReadFile(name) | 83 contents = input_api.ReadFile(name) |
84 if (len(re.findall(headings_re, contents)) != | 84 if (len(re.findall(headings_re, contents)) != |
85 len(re.findall(ids_re, contents))): | 85 len(re.findall(ids_re, contents))): |
86 bad_files.append(name) | 86 bad_files.append(name) |
87 return bad_files | 87 return bad_files |
88 | 88 |
89 def _CheckVersions(input_api, output_api, results): | 89 def _CheckVersions(input_api, output_api, results): |
90 version = '_VERSION =' | 90 version = '_VERSION =' |
91 for affected_file in input_api.AffectedFiles(): | 91 for affected_file in input_api.AffectedFiles(): |
92 if affected_file.LocalPath().endswith('PRESUBMIT.py'): | 92 local_path = affected_file.LocalPath() |
| 93 if not fnmatch.fnmatch(local_path, '%s*' % SERVER2_PATH): |
| 94 continue |
| 95 if local_path.endswith('PRESUBMIT.py'): |
93 continue | 96 continue |
94 if any(version in line for line in affected_file.NewContents()): | 97 if any(version in line for line in affected_file.NewContents()): |
95 found = False | 98 found = False |
96 for _, text in affected_file.ChangedContents(): | 99 for _, text in affected_file.ChangedContents(): |
97 if version in text: | 100 if version in text: |
98 found = True | 101 found = True |
99 break | 102 break |
100 if not found: | 103 if not found: |
101 results.append(output_api.PresubmitError( | 104 results.append(output_api.PresubmitError( |
102 '_VERSION of %s needs to be incremented.' % affected_file)) | 105 '_VERSION of %s needs to be incremented.' % affected_file)) |
(...skipping 15 matching lines...) Expand all Loading... |
118 except input_api.subprocess.CalledProcessError: | 121 except input_api.subprocess.CalledProcessError: |
119 results.append(output_api.PresubmitError('IntegrationTest failed!')) | 122 results.append(output_api.PresubmitError('IntegrationTest failed!')) |
120 _CheckVersions(input_api, output_api, results) | 123 _CheckVersions(input_api, output_api, results) |
121 return results | 124 return results |
122 | 125 |
123 def CheckChangeOnUpload(input_api, output_api): | 126 def CheckChangeOnUpload(input_api, output_api): |
124 return _CheckChange(input_api, output_api) | 127 return _CheckChange(input_api, output_api) |
125 | 128 |
126 def CheckChangeOnCommit(input_api, output_api): | 129 def CheckChangeOnCommit(input_api, output_api): |
127 return _CheckChange(input_api, output_api) | 130 return _CheckChange(input_api, output_api) |
OLD | NEW |