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 5 6def CheckChangeOnUpload(input_api, output_api): 7 return _CommonChecks(input_api, output_api) 8 9 10def CheckChangeOnCommit(input_api, output_api): 11 return _CommonChecks(input_api, output_api) 12 13 14def _CommonChecks(input_api, output_api): 15 results = [] 16 results += input_api.RunTests(input_api.canned_checks.GetPylint( 17 input_api, output_api, extra_paths_list=_GetPathsToPrepend(input_api), 18 pylintrc='pylintrc')) 19 return results 20 21 22def _GetPathsToPrepend(input_api): 23 project_dir = input_api.PresubmitLocalPath() 24 catapult_dir = input_api.os_path.join(project_dir, '..') 25 return [ 26 project_dir, 27 28 input_api.os_path.join(catapult_dir, 'common', 'py_utils'), 29 30 input_api.os_path.join(catapult_dir, 'third_party', 'mock'), 31 input_api.os_path.join(catapult_dir, 'third_party', 'pyfakefs'), 32 input_api.os_path.join(catapult_dir, 'third_party', 'zipfile'), 33 ] 34