blob: dd957d048228efef72f8b6560b8de19e37157052 [file] [log] [blame]
Christoffer Jansson4e8a7732022-02-08 09:01:12 +01001#!/usr/bin/env vpython3
2
kjellandera013a022016-11-14 05:54:22 -08003# Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
4#
5# Use of this source code is governed by a BSD-style license
6# that can be found in the LICENSE file in the root of the source
7# tree. An additional intellectual property rights grant can be found
8# in the file PATENTS. All contributing project authors may
9# be found in the AUTHORS file in the root of the source tree.
10
11
Christoffer Jansson4e8a7732022-02-08 09:01:12 +010012# Runs PRESUBMIT.py in py3 mode by git cl presubmit.
13USE_PYTHON3 = True
14
15
kjellandera013a022016-11-14 05:54:22 -080016def _CommonChecks(input_api, output_api):
17 results = []
18
kjellandera013a022016-11-14 05:54:22 -080019 # Run the MB unittests.
Christoffer Jansson4e8a7732022-02-08 09:01:12 +010020 results.extend(
21 input_api.canned_checks.RunUnitTestsInDirectory(input_api,
22 output_api,
23 '.',
24 [r'^.+_unittest\.py$'],
25 skip_shebang_check=False,
26 run_on_python2=False))
kjellandera013a022016-11-14 05:54:22 -080027
28 # Validate the format of the mb_config.pyl file.
Christoffer Jansson4e8a7732022-02-08 09:01:12 +010029 cmd = [input_api.python3_executable, 'mb.py', 'validate']
kjellandera013a022016-11-14 05:54:22 -080030 kwargs = {'cwd': input_api.PresubmitLocalPath()}
31 results.extend(input_api.RunTests([
32 input_api.Command(name='mb_validate',
33 cmd=cmd, kwargs=kwargs,
34 message=output_api.PresubmitError)]))
35
36 results.extend(
37 input_api.canned_checks.CheckLongLines(
38 input_api,
39 output_api,
40 maxlen=80,
41 source_file_filter=lambda x: 'mb_config.pyl' in x.LocalPath()))
42
43 return results
44
45
46def CheckChangeOnUpload(input_api, output_api):
47 return _CommonChecks(input_api, output_api)
48
49
50def CheckChangeOnCommit(input_api, output_api):
51 return _CommonChecks(input_api, output_api)