| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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.4' | 9 __version__ = '1.5' |
| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 self.is_committing = is_committing | 244 self.is_committing = is_committing |
| 245 self.tbr = tbr | 245 self.tbr = tbr |
| 246 self.host_url = host_url or 'http://codereview.chromium.org' | 246 self.host_url = host_url or 'http://codereview.chromium.org' |
| 247 | 247 |
| 248 # We expose various modules and functions as attributes of the input_api | 248 # We expose various modules and functions as attributes of the input_api |
| 249 # so that presubmit scripts don't have to import them. | 249 # so that presubmit scripts don't have to import them. |
| 250 self.basename = os.path.basename | 250 self.basename = os.path.basename |
| 251 self.cPickle = cPickle | 251 self.cPickle = cPickle |
| 252 self.cStringIO = cStringIO | 252 self.cStringIO = cStringIO |
| 253 self.json = json | 253 self.json = json |
| 254 self.os_listdir = os.listdir |
| 255 self.os_walk = os.walk |
| 254 self.os_path = os.path | 256 self.os_path = os.path |
| 255 self.pickle = pickle | 257 self.pickle = pickle |
| 256 self.marshal = marshal | 258 self.marshal = marshal |
| 257 self.re = re | 259 self.re = re |
| 258 self.subprocess = subprocess | 260 self.subprocess = subprocess |
| 259 self.tempfile = tempfile | 261 self.tempfile = tempfile |
| 260 self.time = time | 262 self.time = time |
| 261 self.traceback = traceback | 263 self.traceback = traceback |
| 262 self.unittest = unittest | 264 self.unittest = unittest |
| 263 self.urllib2 = urllib2 | 265 self.urllib2 = urllib2 |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 sys.stdout, | 1197 sys.stdout, |
| 1196 sys.stdin, | 1198 sys.stdin, |
| 1197 options.default_presubmit, | 1199 options.default_presubmit, |
| 1198 options.may_prompt) | 1200 options.may_prompt) |
| 1199 return not results.should_continue() | 1201 return not results.should_continue() |
| 1200 | 1202 |
| 1201 | 1203 |
| 1202 if __name__ == '__main__': | 1204 if __name__ == '__main__': |
| 1203 fix_encoding.fix_encoding() | 1205 fix_encoding.fix_encoding() |
| 1204 sys.exit(Main(None)) | 1206 sys.exit(Main(None)) |
| OLD | NEW |