OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 """Top-level presubmit script for reviewbot. |
| 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for |
| 8 details on the presubmit API built into gcl. |
| 9 """ |
| 10 |
| 11 |
| 12 def CommonChecks(input_api, output_api): |
| 13 output = [] |
| 14 |
| 15 join = input_api.os_path.join |
| 16 root = input_api.PresubmitLocalPath() |
| 17 while True: |
| 18 if input_api.os_path.isfile(join(root, 'google_appengine', 'VERSION')): |
| 19 break |
| 20 next_root = input_api.os_path.dirname(root) |
| 21 if next_root == root: |
| 22 return [output_api.PresubmitError('Failed to find Google AppEngine SDK')] |
| 23 root = next_root |
| 24 input_api.logging.debug('Found GAE SDK in %s' % root) |
| 25 |
| 26 import sys |
| 27 sys_path_backup = sys.path |
| 28 try: |
| 29 sys.path = [ |
| 30 join(root, 'google_appengine'), |
| 31 join(root, 'google_appengine', 'lib'), |
| 32 join(root, 'google_appengine', 'lib', 'webapp2-2.5.2'), |
| 33 join(root, 'google_appengine', 'lib', 'webob-1.2.3'), |
| 34 join('third_party', 'google-api-python-client'), |
| 35 ] + sys.path |
| 36 output.extend(input_api.canned_checks.RunPylint( |
| 37 input_api, |
| 38 output_api)) |
| 39 finally: |
| 40 sys.path = sys_path_backup |
| 41 |
| 42 return output |
| 43 |
| 44 |
| 45 def CheckChangeOnUpload(input_api, output_api): |
| 46 return CommonChecks(input_api, output_api) |
| 47 |
| 48 |
| 49 def CheckChangeOnCommit(input_api, output_api): |
| 50 return CommonChecks(input_api, output_api) |
OLD | NEW |