From bdde5d002c8780eef9bde5dc78c28b0f90fc2356 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 19 Jan 2021 21:42:05 +0100 Subject: [PATCH] Use Python to check the version of pylint This reduces dependencies, doesn't require maintainers to know awk, and makes the version parsing more robust. Signed-off-by: Gilles Peskine --- tests/scripts/check-python-files.sh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/scripts/check-python-files.sh b/tests/scripts/check-python-files.sh index df4821a33..d82ea746c 100755 --- a/tests/scripts/check-python-files.sh +++ b/tests/scripts/check-python-files.sh @@ -28,19 +28,24 @@ else PYTHON=python fi +check_version () { + $PYTHON - "$2" </dev/null --version | awk ' - BEGIN {status = 1} - /^(pylint[0-9]*|__main__\.py) +[0-9]+\.[0-9]+/ { - split($2, version, /[^0-9]+/); - status = !(version[1] >= 2 || (version[1] == 1 && version[2] >= 8)); - exit; # executes the END block - } - END {exit status} - ' + check_version pylint 1.8.3 } can_mypy () {