| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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.5' | 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 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 31 import traceback # Exposed through the API. | 31 import traceback # Exposed through the API. |
| 32 import types | 32 import types |
| 33 import unittest # Exposed through the API. | 33 import unittest # Exposed through the API. |
| 34 import urllib2 # Exposed through the API. | 34 import urllib2 # Exposed through the API. |
| 35 from warnings import warn | 35 from warnings import warn |
| 36 | 36 |
| 37 try: | 37 try: |
| 38 import simplejson as json # pylint: disable=F0401 | 38 import simplejson as json # pylint: disable=F0401 |
| 39 except ImportError: | 39 except ImportError: |
| 40 try: | 40 try: |
| 41 import json | 41 import json # pylint: disable=F0401 |
| 42 # Some versions of python2.5 have an incomplete json module. Check to make | 42 except ImportError: |
| 43 # sure loads exists. | |
| 44 # Statement seems to have no effect | |
| 45 # pylint: disable=W0104 | |
| 46 json.loads | |
| 47 except (ImportError, AttributeError): | |
| 48 # Import the one included in depot_tools. | 43 # Import the one included in depot_tools. |
| 49 sys.path.append(os.path.join(os.path.dirname(__file__), 'third_party')) | 44 sys.path.append(os.path.join(os.path.dirname(__file__), 'third_party')) |
| 50 import simplejson as json # pylint: disable=F0401 | 45 import simplejson as json # pylint: disable=F0401 |
| 51 | 46 |
| 52 # Local imports. | 47 # Local imports. |
| 53 import fix_encoding | 48 import fix_encoding |
| 54 import gclient_utils | 49 import gclient_utils |
| 55 import owners | 50 import owners |
| 56 import presubmit_canned_checks | 51 import presubmit_canned_checks |
| 57 import scm | 52 import scm |
| (...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 sys.stdout, | 1192 sys.stdout, |
| 1198 sys.stdin, | 1193 sys.stdin, |
| 1199 options.default_presubmit, | 1194 options.default_presubmit, |
| 1200 options.may_prompt) | 1195 options.may_prompt) |
| 1201 return not results.should_continue() | 1196 return not results.should_continue() |
| 1202 | 1197 |
| 1203 | 1198 |
| 1204 if __name__ == '__main__': | 1199 if __name__ == '__main__': |
| 1205 fix_encoding.fix_encoding() | 1200 fix_encoding.fix_encoding() |
| 1206 sys.exit(Main(None)) | 1201 sys.exit(Main(None)) |
| OLD | NEW |