kbr | e85ee56 | 2016-02-09 04:37:35 | [diff] [blame] | 1 | # Copyright (c) 2016 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 gpu. |
| 6 | |
| 7 | See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 8 | for more details about the presubmit API built into depot_tools. |
| 9 | """ |
| 10 | |
Jonathan Backer | 16cd536 | 2018-01-17 17:00:10 | [diff] [blame] | 11 | def CommonChecks(input_api, output_api): |
| 12 | import sys |
| 13 | |
| 14 | output = [] |
| 15 | sys_path_backup = sys.path |
| 16 | try: |
| 17 | sys.path = [ |
| 18 | input_api.PresubmitLocalPath() |
| 19 | ] + sys.path |
| 20 | disabled_warnings = [ |
| 21 | 'W0622', # redefined-builtin |
| 22 | 'R0923', # interface-not-implemented |
| 23 | ] |
| 24 | output.extend(input_api.canned_checks.RunPylint( |
| 25 | input_api, |
| 26 | output_api, |
| 27 | disabled_warnings=disabled_warnings)) |
| 28 | finally: |
| 29 | sys.path = sys_path_backup |
| 30 | |
| 31 | return output |
| 32 | |
| 33 | |
| 34 | def CheckChangeOnUpload(input_api, output_api): |
| 35 | return CommonChecks(input_api, output_api) |
| 36 | |
| 37 | |
| 38 | def CheckChangeOnCommit(input_api, output_api): |
| 39 | return CommonChecks(input_api, output_api) |