Parcourir la source

Add pylint-2.7

R=apolito@google.com, dpranke@google.com

Bug: 1257792
Change-Id: I61a37d4b48dde0b7e1975d95d8fd627b9cbfb65b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3214207
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Josip Sokcevic il y a 3 ans
Parent
commit
59e3296a7e
3 fichiers modifiés avec 88 ajouts et 4 suppressions
  1. 5 4
      presubmit_canned_checks.py
  2. 71 0
      pylint-2.7
  3. 12 0
      pylint-2.7.bat

+ 5 - 4
presubmit_canned_checks.py

@@ -940,15 +940,16 @@ def GetPylint(input_api,
 
   The default files_to_check enforces looking only at *.py files.
 
-  Currently only pylint version '1.5' and '2.6' are supported.
+  Currently only pylint version '1.5', '2.6' and '2.7' are supported.
   """
 
   files_to_check = tuple(files_to_check or (r'.*\.py$', ))
   files_to_skip = tuple(files_to_skip or input_api.DEFAULT_FILES_TO_SKIP)
   extra_paths_list = extra_paths_list or []
 
-  assert version in ('1.5', '2.6'), 'Unsupported pylint version: ' + version
-  python3 = (version == '2.6')
+  assert version in ('1.5', '2.6', '2.7'), \
+      'Unsupported pylint version: ' + version
+  python2 = (version == '1.5')
 
   if input_api.is_committing:
     error_type = output_api.PresubmitError
@@ -1036,7 +1037,7 @@ def GetPylint(input_api,
         cmd=cmd,
         kwargs=kwargs,
         message=error_type,
-        python3=python3)
+        python3=not python2)
 
   # Always run pylint and pass it all the py files at once.
   # Passing py files one at time is slower and can produce

+ 71 - 0
pylint-2.7

@@ -0,0 +1,71 @@
+#!/usr/bin/env vpython3
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Note: We use tags here instead of refs because refs will always hit the
+# network to see if there are any updates.
+
+# [VPYTHON:BEGIN]
+# # Third party dependencies.  These are only listed because pylint itself needs
+# # them.  Feel free to add/remove anything here.
+# python_version: "3"
+#
+# wheel: <
+#   name: "infra/python/wheels/futures-py2_py3"
+#   version: "version:3.1.1"
+# >
+# wheel: <
+#   name: "infra/python/wheels/isort-py2_py3"
+#   version: "version:4.3.4"
+# >
+# wheel: <
+#   name: "infra/python/wheels/mccabe-py2_py3"
+#   version: "version:0.6.1"
+# >
+# wheel: <
+#   name: "infra/python/wheels/six-py2_py3"
+#   version: "version:1.15.0"
+# >
+# wheel: <
+#   name: "infra/python/wheels/toml-py3"
+#   version: "version:0.10.1"
+# >
+# wheel: <
+#   name: "infra/python/wheels/wrapt/${vpython_platform}"
+#   version: "version:1.12.1"
+# >
+# wheel: <
+#   name: "infra/python/wheels/lazy-object-proxy/${vpython_platform}"
+#   version: "version:1.4.3"
+# >
+# wheel: <
+#   name: "infra/python/wheels/colorama-py3"
+#   version: "version:0.4.1"
+# >
+#
+# # Pylint extensions.
+#
+# wheel: <
+#   name: "infra/python/wheels/pylint-quotes-py3"
+#   version: "version:0.2.1"
+# >
+#
+# # Pylint dependencies.
+#
+# wheel: <
+#   name: "infra/python/wheels/astroid-py3"
+#   version: "version:2.4.2"
+# >
+# wheel: <
+#   name: "infra/python/wheels/pylint-py3"
+#   version: "version:2.7.4"
+# >
+#
+# [VPYTHON:END]
+
+import sys
+
+import pylint_main
+
+sys.exit(pylint_main.main(sys.argv[1:]))

+ 12 - 0
pylint-2.7.bat

@@ -0,0 +1,12 @@
+@echo off
+:: Copyright 2021 The Chromium Authors. All rights reserved.
+:: Use of this source code is governed by a BSD-style license that can be
+:: found in the LICENSE file.
+setlocal
+
+:: Ensure that "depot_tools" is somewhere in PATH so this tool can be used
+:: standalone, but allow other PATH manipulations to take priority.
+set PATH=%PATH%;%~dp0
+
+:: Defer control.
+vpython3 "%~dp0\pylint-2.7" %*