1 # Copyright 2014 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 """Presubmit script for mojo
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into depot_tools.
14 PRESUBMIT_VERSION = '2.0.0'
16 def CheckChange(input_api, output_api):
17 # Additional python module paths (we're in src/mojo/); not everyone needs
18 # them, but it's easiest to add them to everyone's path.
20 third_party_path = os.path.join(
21 input_api.PresubmitLocalPath(), "..", "third_party")
22 # For the bindings generator:
23 mojo_public_bindings_pylib_path = os.path.join(
24 input_api.PresubmitLocalPath(), "public", "tools", "bindings", "pylib")
25 # For the python bindings:
26 mojo_python_bindings_path = os.path.join(
27 input_api.PresubmitLocalPath(), "public", "python")
28 # TODO(vtl): Don't lint these files until the (many) problems are fixed
29 # (possibly by deleting/rewriting some files).
30 files_to_skip = input_api.DEFAULT_FILES_TO_SKIP + \
31 (r".*\bpublic[\\\/]tools[\\\/]bindings[\\\/]pylib[\\\/]mojom[\\\/]"
32 r"generate[\\\/].+\.py$",
33 r".*\bpublic[\\\/]tools[\\\/]bindings[\\\/]checks[\\\/].+\.py$",
34 r".*\bpublic[\\\/]tools[\\\/]bindings[\\\/]generators[\\\/].+\.py$",
35 r".*\bspy[\\\/]ui[\\\/].+\.py$",
36 r".*\btools[\\\/]pylib[\\\/]transitive_hash\.py$",
37 r".*\btools[\\\/]test_runner\.py$")
40 pylint_extra_paths = [
42 mojo_public_bindings_pylib_path,
43 mojo_python_bindings_path,
45 results += input_api.canned_checks.RunPylint(
46 input_api, output_api, extra_paths_list=pylint_extra_paths,
47 files_to_skip=files_to_skip)