1# Copyright 2015 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 5import sys 6 7def RunChecks(input_api, output_api): 8 results = [] 9 from build import presubmit_checks 10 results += presubmit_checks.RunChecks(input_api) 11 12 return map(output_api.PresubmitError, results) 13 14def CheckChange(input_api, output_api): 15 original_sys_path = sys.path 16 try: 17 sys.path += [input_api.PresubmitLocalPath()] 18 return RunChecks(input_api, output_api) 19 finally: 20 sys.path = original_sys_path 21 22def CheckChangeOnUpload(input_api, output_api): 23 return CheckChange(input_api, output_api) 24 25def CheckChangeOnCommit(input_api, output_api): 26 return CheckChange(input_api, output_api) 27