From 59e3296a7ec72bd981a066505a49cdc3f36c559d Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Mon, 11 Oct 2021 22:36:14 +0000 Subject: [PATCH] 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 Reviewed-by: Dirk Pranke --- presubmit_canned_checks.py | 9 ++--- pylint-2.7 | 71 ++++++++++++++++++++++++++++++++++++++ pylint-2.7.bat | 12 +++++++ 3 files changed, 88 insertions(+), 4 deletions(-) create mode 100755 pylint-2.7 create mode 100644 pylint-2.7.bat diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index af4d0ac135..f36fa8ee03 100644 --- a/presubmit_canned_checks.py +++ b/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 diff --git a/pylint-2.7 b/pylint-2.7 new file mode 100755 index 0000000000..e05b33e37f --- /dev/null +++ b/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:])) diff --git a/pylint-2.7.bat b/pylint-2.7.bat new file mode 100644 index 0000000000..a65a62b836 --- /dev/null +++ b/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" %*