Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Side by Side Diff: chrome/common/extensions/PRESUBMIT.py

Issue 14267024: Devserver: have a separate ObjectStore namespace (both memcache and datastore) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove _CheckVersions Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/api_data_source.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if not os.path.exists(name): 85 if not os.path.exists(name):
86 continue 86 continue
87 if (fnmatch.fnmatch(name, '*%s*' % INTROS_PATH) or 87 if (fnmatch.fnmatch(name, '*%s*' % INTROS_PATH) or
88 fnmatch.fnmatch(name, '*%s*' % ARTICLES_PATH)): 88 fnmatch.fnmatch(name, '*%s*' % ARTICLES_PATH)):
89 contents = input_api.ReadFile(name) 89 contents = input_api.ReadFile(name)
90 if (len(re.findall(headings_re, contents)) != 90 if (len(re.findall(headings_re, contents)) !=
91 len(re.findall(ids_re, contents))): 91 len(re.findall(ids_re, contents))):
92 bad_files.append(name) 92 bad_files.append(name)
93 return bad_files 93 return bad_files
94 94
95 def _CheckVersions(input_api, output_api, results):
96 version = '_VERSION ='
97 for affected_file in input_api.AffectedFiles():
98 local_path = affected_file.LocalPath()
99 if not fnmatch.fnmatch(local_path, '%s*' % SERVER2_PATH):
100 continue
101 if local_path.endswith('PRESUBMIT.py'):
102 continue
103 if any(version in line for line in affected_file.NewContents()):
104 found = False
105 for _, text in affected_file.ChangedContents():
106 if version in text:
107 found = True
108 break
109 if not found:
110 results.append(output_api.PresubmitPromptWarning(
111 '_VERSION of %s needs to be incremented.' % affected_file))
112
113 def _CheckLinks(input_api, output_api, results): 95 def _CheckLinks(input_api, output_api, results):
114 for affected_file in input_api.AffectedFiles(): 96 for affected_file in input_api.AffectedFiles():
115 name = affected_file.LocalPath() 97 name = affected_file.LocalPath()
116 absolute_path = affected_file.AbsoluteLocalPath() 98 absolute_path = affected_file.AbsoluteLocalPath()
117 if not os.path.exists(absolute_path): 99 if not os.path.exists(absolute_path):
118 continue 100 continue
119 if (fnmatch.fnmatch(name, '%s*' % PUBLIC_TEMPLATES_PATH) or 101 if (fnmatch.fnmatch(name, '%s*' % PUBLIC_TEMPLATES_PATH) or
120 fnmatch.fnmatch(name, '%s*' % INTROS_PATH) or 102 fnmatch.fnmatch(name, '%s*' % INTROS_PATH) or
121 fnmatch.fnmatch(name, '%s*' % ARTICLES_PATH) or 103 fnmatch.fnmatch(name, '%s*' % ARTICLES_PATH) or
122 fnmatch.fnmatch(name, '%s*' % API_PATH)): 104 fnmatch.fnmatch(name, '%s*' % API_PATH)):
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 # From depot_tools/presubmit_canned_checks.py:529 137 # From depot_tools/presubmit_canned_checks.py:529
156 if input_api.platform == 'win32': 138 if input_api.platform == 'win32':
157 integration_test = [input_api.python_executable] 139 integration_test = [input_api.python_executable]
158 integration_test.append( 140 integration_test.append(
159 os.path.join('docs', 'server2', 'integration_test.py')) 141 os.path.join('docs', 'server2', 'integration_test.py'))
160 integration_test.extend(_CreateIntegrationTestArgs(input_api.LocalPaths())) 142 integration_test.extend(_CreateIntegrationTestArgs(input_api.LocalPaths()))
161 input_api.subprocess.check_call(integration_test, 143 input_api.subprocess.check_call(integration_test,
162 cwd=input_api.PresubmitLocalPath()) 144 cwd=input_api.PresubmitLocalPath())
163 except input_api.subprocess.CalledProcessError: 145 except input_api.subprocess.CalledProcessError:
164 results.append(output_api.PresubmitError('IntegrationTest failed!')) 146 results.append(output_api.PresubmitError('IntegrationTest failed!'))
165 _CheckVersions(input_api, output_api, results)
166 _CheckLinks(input_api, output_api, results) 147 _CheckLinks(input_api, output_api, results)
167 return results 148 return results
168 149
169 def CheckChangeOnUpload(input_api, output_api): 150 def CheckChangeOnUpload(input_api, output_api):
170 return _CheckChange(input_api, output_api) 151 return _CheckChange(input_api, output_api)
171 152
172 def CheckChangeOnCommit(input_api, output_api): 153 def CheckChangeOnCommit(input_api, output_api):
173 return _CheckChange(input_api, output_api) 154 return _CheckChange(input_api, output_api)
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/api_data_source.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698