From 9a296eded981d2b59c3a8fda44fb8b335da29d6c Mon Sep 17 00:00:00 2001 From: Patryk Obara Date: Fri, 15 Nov 2019 16:50:45 +0100 Subject: [PATCH] Force python3 pylint Some distributions provide python2 version of pylint package by default, but all provide pylint for python3 in some package. Python 2 reaches EOL in few months, so there's no reason to support it. This prevents our scripts from being accidentally marked invalid due to language changes between python 2 and 3. Also, newer pylint has nicer output, that provides exact module filename straight in the warning. --- scripts/verify-python.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/verify-python.sh b/scripts/verify-python.sh index 5b5b26b6..92f2cc2c 100755 --- a/scripts/verify-python.sh +++ b/scripts/verify-python.sh @@ -7,6 +7,11 @@ # the repo. You can pass additional parameters to this script itself, e.g.: # # $ ./verify-python.sh --disable= +# +# This script uses exclusively python3 version of pylint; most distributions +# provide it in a package pylint, but some call it pylint3 or python3-pylint. + +set -e list_python_files () { git ls-files \ @@ -16,11 +21,13 @@ list_python_files () { } main () { - pylint --version >&2 + # Using "python3 -m pylint" to avoid using python2-only + # version of pylint by mistake. + python3 -m pylint --version >&2 echo "Checking files:" >&2 list_python_files >&2 local -r rc="$(git rev-parse --show-toplevel)/.pylint" - list_python_files | xargs -L 1000 pylint --rcfile="$rc" "$@" + list_python_files | xargs -L 1000 python3 -m pylint --rcfile="$rc" "$@" } main "$@"