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 | |
Brian Sheedy | d406c1a | 2022-06-07 00:03:16 | [diff] [blame] | 11 | import sys |
| 12 | |
Fabrice de Gans | 7a4c68a | 2021-06-23 18:40:03 | [diff] [blame] | 13 | |
| 14 | USE_PYTHON3 = True |
| 15 | |
| 16 | |
Jonathan Backer | 16cd536 | 2018-01-17 17:00:10 | [diff] [blame] | 17 | def CommonChecks(input_api, output_api): |
Jonathan Backer | 16cd536 | 2018-01-17 17:00:10 | [diff] [blame] | 18 | |
| 19 | output = [] |
| 20 | sys_path_backup = sys.path |
| 21 | try: |
| 22 | sys.path = [ |
| 23 | input_api.PresubmitLocalPath() |
| 24 | ] + sys.path |
Brian Sheedy | e31df482 | 2022-06-03 04:22:17 | [diff] [blame] | 25 | pylint_checks = input_api.canned_checks.GetPylint( |
| 26 | input_api, |
| 27 | output_api, |
| 28 | version='2.7') |
Brian Sheedy | d406c1a | 2022-06-07 00:03:16 | [diff] [blame] | 29 | output.extend(input_api.RunTests(pylint_checks)) |
Jonathan Backer | 16cd536 | 2018-01-17 17:00:10 | [diff] [blame] | 30 | finally: |
| 31 | sys.path = sys_path_backup |
| 32 | |
| 33 | return output |
| 34 | |
| 35 | |
| 36 | def CheckChangeOnUpload(input_api, output_api): |
| 37 | return CommonChecks(input_api, output_api) |
| 38 | |
| 39 | |
| 40 | def CheckChangeOnCommit(input_api, output_api): |
| 41 | return CommonChecks(input_api, output_api) |