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

Side by Side Diff: presubmit_support.py

Issue 115719: Add InputApi.version so the presubmit script can mark a minimum supported version for instance. (Closed)
Patch Set: Created 11 years, 7 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
« no previous file with comments | « no previous file | tests/presubmit_unittest.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 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Enables directory-specific presubmit checks to run at upload and/or commit. 6 """Enables directory-specific presubmit checks to run at upload and/or commit.
7 """ 7 """
8 8
9 __version__ = '1.0.1' 9 __version__ = '1.1'
10 10
11 # TODO(joi) Add caching where appropriate/needed. The API is designed to allow 11 # TODO(joi) Add caching where appropriate/needed. The API is designed to allow
12 # caching (between all different invocations of presubmit scripts for a given 12 # caching (between all different invocations of presubmit scripts for a given
13 # change). We should add it as our presubmit scripts start feeling slow. 13 # change). We should add it as our presubmit scripts start feeling slow.
14 14
15 import cPickle # Exposed through the API. 15 import cPickle # Exposed through the API.
16 import cStringIO # Exposed through the API. 16 import cStringIO # Exposed through the API.
17 import exceptions 17 import exceptions
18 import fnmatch 18 import fnmatch
19 import glob 19 import glob
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 know stuff about the change they're looking at. 155 know stuff about the change they're looking at.
156 """ 156 """
157 157
158 def __init__(self, change, presubmit_path): 158 def __init__(self, change, presubmit_path):
159 """Builds an InputApi object. 159 """Builds an InputApi object.
160 160
161 Args: 161 Args:
162 change: A presubmit.GclChange object. 162 change: A presubmit.GclChange object.
163 presubmit_path: The path to the presubmit script being processed. 163 presubmit_path: The path to the presubmit script being processed.
164 """ 164 """
165 # Version number of the presubmit_support script.
166 self.version = [int(x) for x in __version__.split('.')]
165 self.change = change 167 self.change = change
166 168
167 # We expose various modules and functions as attributes of the input_api 169 # We expose various modules and functions as attributes of the input_api
168 # so that presubmit scripts don't have to import them. 170 # so that presubmit scripts don't have to import them.
169 self.basename = os.path.basename 171 self.basename = os.path.basename
170 self.cPickle = cPickle 172 self.cPickle = cPickle
171 self.cStringIO = cStringIO 173 self.cStringIO = cStringIO
172 self.os_path = os.path 174 self.os_path = os.path
173 self.pickle = pickle 175 self.pickle = pickle
174 self.marshal = marshal 176 self.marshal = marshal
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 return not DoPresubmitChecks(gcl.ChangeInfo(name='temp', files=files), 744 return not DoPresubmitChecks(gcl.ChangeInfo(name='temp', files=files),
743 options.commit, 745 options.commit,
744 options.verbose, 746 options.verbose,
745 sys.stdout, 747 sys.stdout,
746 sys.stdin, 748 sys.stdin,
747 default_presubmit=None) 749 default_presubmit=None)
748 750
749 751
750 if __name__ == '__main__': 752 if __name__ == '__main__':
751 sys.exit(Main(sys.argv)) 753 sys.exit(Main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698