From aff36823df43b31a0ef35cc5e1c0ec0eccb244f1 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 30 Dec 2017 21:37:05 +0000 Subject: [PATCH] Complete switch from pep8 to pycodestyle for Python testing --- CHANGES.current | 4 ++++ Examples/Makefile.in | 8 ++++---- Examples/test-suite/python/Makefile.in | 10 +++++----- configure.ac | 8 ++++---- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/CHANGES.current b/CHANGES.current index 1c361fbec..ac04b3b29 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ Version 4.0.0 (in progress) =========================== +2017-12-30: wsfulton + [Python] Replace pep8 with pycodestyle for checking the Python code style when + running Python tests. + 2017-12-13: wsfulton [Perl] add missing support for directorfree typemaps. diff --git a/Examples/Makefile.in b/Examples/Makefile.in index e020a659a..81697c8b2 100644 --- a/Examples/Makefile.in +++ b/Examples/Makefile.in @@ -334,8 +334,8 @@ else SWIGOPTPY3 = -py3 endif -PEP8 = @PEP8@ -PEP8_FLAGS = --ignore=E402,E501,E30,W291,W391 +PYCODESTYLE = @PYCODESTYLE@ +PYCODESTYLE_FLAGS = --ignore=E402,E501,E30,W291,W391 # ---------------------------------------------------------------- # Build a C dynamically loadable module @@ -389,8 +389,8 @@ endif PY2TO3 = @PY2TO3@ `@PY2TO3@ -l | grep -v -E "Available|import$$" | awk '{print "-f "$$0}'` python_run: $(PYSCRIPT) -ifneq (,$(PEP8)) - $(COMPILETOOL) $(PEP8) $(PEP8_FLAGS) $(PYSCRIPT) +ifneq (,$(PYCODESTYLE)) + $(COMPILETOOL) $(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $(PYSCRIPT) endif env PYTHONPATH=$$PWD $(RUNTOOL) $(PYTHON) $(PYSCRIPT) $(RUNPIPE) diff --git a/Examples/test-suite/python/Makefile.in b/Examples/test-suite/python/Makefile.in index 869426569..12844e311 100644 --- a/Examples/test-suite/python/Makefile.in +++ b/Examples/test-suite/python/Makefile.in @@ -10,8 +10,8 @@ endif LANGUAGE = python PYTHON = $(PYBIN) -PEP8 = @PEP8@ -PEP8_FLAGS = --ignore=E30,E402,E501,E731,W291,W391 +PYCODESTYLE = @PYCODESTYLE@ +PYCODESTYLE_FLAGS = --ignore=E30,E402,E501,E731,W291,W391 #*_runme.py for Python 2.x, *_runme3.py for Python 3.x PY2SCRIPTSUFFIX = _runme.py @@ -141,12 +141,12 @@ py_runme = $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) py2_runme = $(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX) py3_runme = $(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX) -ifneq (,$(PEP8)) -check_pep8 = $(COMPILETOOL) $(PEP8) $(PEP8_FLAGS) $(SCRIPTPREFIX)$*.py +ifneq (,$(PYCODESTYLE)) +check_pep8 = $(COMPILETOOL) $(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $(SCRIPTPREFIX)$*.py check_pep8_multi_cpp = \ for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \ - $(COMPILETOOL) $(PEP8) $(PEP8_FLAGS) $$f.py; \ + $(COMPILETOOL) $(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $$f.py; \ done endif diff --git a/configure.ac b/configure.ac index cd5992d02..cfc338126 100644 --- a/configure.ac +++ b/configure.ac @@ -895,11 +895,11 @@ else fi if test -n "$PYINCLUDE" || test -n "$PY3INCLUDE" ; then - AC_CHECK_PROGS(PEP8, pycodestyle) - if test -n "$PEP8"; then + AC_CHECK_PROGS(PYCODESTYLE, pycodestyle) + if test -n "$PYCODESTYLE"; then AC_MSG_CHECKING(pycodestyle version) - pep8_version=`$PEP8 --version 2>/dev/null` - AC_MSG_RESULT($pep8_version) + pycodestyle_version=`$PYCODESTYLE --version 2>/dev/null` + AC_MSG_RESULT($pycodestyle_version) fi fi