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 7 8def RunChecks(input_api, output_api): 9 results = [] 10 from tracing.build import check_gypi 11 err = check_gypi.GypiCheck() 12 if err: 13 results += [err] 14 15 from tracing.build import js_checks 16 results += js_checks.RunChecks(input_api) 17 18 return map(output_api.PresubmitError, results) 19 20 21def CheckChange(input_api, output_api): 22 original_sys_path = sys.path 23 try: 24 sys.path += [input_api.PresubmitLocalPath()] 25 return RunChecks(input_api, output_api) 26 finally: 27 sys.path = original_sys_path 28 29 30def CheckChangeOnUpload(input_api, output_api): 31 return CheckChange(input_api, output_api) 32 33 34def CheckChangeOnCommit(input_api, output_api): 35 return CheckChange(input_api, output_api) 36