It turns out that
a) the standalone pep8 executable is deprecated in favour of pycodestyle
b) $python-pep8 does not exist in modern distros
and thus the style checks for Python scripts have been skipped for a
long time.
Instead, switch to pycodestyle directly, updating the list of ignored
issues to the two categories left.
---
config.sh.in | 1 +
m4/guestfs-progs.m4 | 3 +++
v2v/test-v2v-python-syntax.sh | 13 +++++--------
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/config.sh.in b/config.sh.in
index f3245379..be304b39 100644
--- a/config.sh.in
+++ b/config.sh.in
@@ -20,3 +20,4 @@
# mostly used in other shell scripts.
export VIRT_V2V_NBDKIT_PYTHON_PLUGIN="@VIRT_V2V_NBDKIT_PYTHON_PLUGIN@"
+export PYCODESTYLE="@PYCODESTYLE@"
diff --git a/m4/guestfs-progs.m4 b/m4/guestfs-progs.m4
index 5f481a75..56baa857 100644
--- a/m4/guestfs-progs.m4
+++ b/m4/guestfs-progs.m4
@@ -73,3 +73,6 @@ AS_IF([test "x$VALGRIND" != "xno"],[
])
AC_SUBST([VG])
AM_SUBST_NOTMAKE([VG])
+
+dnl pycodestyle, used to check the Python scripts.
+AC_CHECK_PROGS([PYCODESTYLE],[pycodestyle],[no])
diff --git a/v2v/test-v2v-python-syntax.sh b/v2v/test-v2v-python-syntax.sh
index e2936826..4fd2184a 100755
--- a/v2v/test-v2v-python-syntax.sh
+++ b/v2v/test-v2v-python-syntax.sh
@@ -34,12 +34,9 @@ done
# Checks the files correspond to PEP8 coding style.
#
https://www.python.org/dev/peps/pep-0008/
-if $python-pep8 --version >/dev/null 2>&1; then
- for f in $files; do
- # Ignore:
- # E226 missing whitespace around arithmetic operator
- # E251 unexpected spaces around keyword / parameter equals
- # E302 expected 2 blank lines, found 1
- $python-pep8 --ignore=E226,E251,E302 "$f"
- done
+if test "x$PYCODESTYLE" != xno; then
+ # Ignore:
+ # E501 line too long
+ # E722 do not use bare 'except'
+ $PYCODESTYLE --ignore=E501,E722 $files
fi
--
2.24.1