From 0f94ea9208cee6e77030b9b874900730b29c4e7c Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Mon, 11 May 2015 00:09:40 +0100 Subject: [PATCH] Example and test-suite makefile tidy up Python output is less verbose if pep8 is not available (tweaks for patch #416) --- Examples/Makefile.in | 30 +++++++++++--------------- Examples/test-suite/python/Makefile.in | 13 +++++------ 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/Examples/Makefile.in b/Examples/Makefile.in index 36f68f2e1..61f127569 100644 --- a/Examples/Makefile.in +++ b/Examples/Makefile.in @@ -66,9 +66,6 @@ LIBCRYPT = @LIBCRYPT@ SYSLIBS = $(LIBM) $(LIBC) $(LIBCRYPT) LIBPREFIX = -PEP8 = @PEP8@ -PEP8_FLAGS = --ignore=E402,E501,E30,W291,W391 - # RUNTOOL is for use with runtime tools, eg set it to valgrind RUNTOOL = # COMPILETOOL is a way to run the compiler under another tool, or more commonly just to stop the compiler executing @@ -324,6 +321,9 @@ else SWIGPYTHON = $(SWIG) -python -py3 endif +PEP8 = @PEP8@ +PEP8_FLAGS = --ignore=E402,E501,E30,W291,W391 + # ---------------------------------------------------------------- # Build a C dynamically loadable module # ---------------------------------------------------------------- @@ -375,9 +375,11 @@ endif PY2TO3 = 2to3 `2to3 -l | grep -v -E "Available|import$$" | awk '{print "-f "$$0}'` -python_run: $(PYSCRIPT) python_check - export PYTHONPATH=".:$$PYTHONPATH"; \ - $(RUNTOOL) $(PYTHON) $(PYSCRIPT) $(RUNPIPE) +python_run: $(PYSCRIPT) +ifneq (,$(PEP8)) + $(PEP8) $(PEP8_FLAGS) $(PYSCRIPT) +endif + env PYTHONPATH=$$PWD $(RUNTOOL) $(PYTHON) $(PYSCRIPT) $(RUNPIPE) ifneq (,$(SRCDIR)) $(RUNME).py: $(SRCDIR)$(RUNME).py @@ -388,16 +390,6 @@ $(RUNME)3.py: $(SRCDIR)$(RUNME).py cp $< $@ $(PY2TO3) -w $@ >/dev/null 2>&1 -# ----------------------------------------------------------------- -# Run Python pep8 if it exists -# ----------------------------------------------------------------- - -python_check: $(PYSCRIPT) - +if [ -n "$(PEP8)" ]; then \ - $(PEP8) $(PEP8_FLAGS) $(PYSCRIPT) || true;\ - fi - - # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- @@ -1742,7 +1734,7 @@ scilab_cpp: # ----------------------------------------------------------------- scilab_run: - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) $(SCILAB_OPT) -f $(SRCDIR)$(RUNME).sci $(RUNPIPE) + env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(SCILAB) $(SCILAB_OPT) -f $(SRCDIR)$(RUNME).sci $(RUNPIPE) # ----------------------------------------------------------------- # Scilab version @@ -1765,6 +1757,10 @@ scilab_clean: ##### Go ###### ################################################################## +# TODO: The Go make targets need simplifying to use configure time +# configuration or to use Make's ifeq rather than using lots of +# runtime shell code. The output will then be a lot less verbose. + GO = @GO@ GOGCC = @GOGCC@ GCCGO = @GCCGO@ diff --git a/Examples/test-suite/python/Makefile.in b/Examples/test-suite/python/Makefile.in index 82a0e9db1..66bbbcb6b 100644 --- a/Examples/test-suite/python/Makefile.in +++ b/Examples/test-suite/python/Makefile.in @@ -125,17 +125,14 @@ py_runme = $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) py2_runme = $(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX) py3_runme = $(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX) -check_pep8 = \ - if [ -n "$(PEP8)" ]; then \ - $(PEP8) $(PEP8_FLAGS) $(SCRIPTPREFIX)$*.py;\ - fi +ifneq (,$(PEP8)) +check_pep8 = $(PEP8) $(PEP8_FLAGS) $(SCRIPTPREFIX)$*.py check_pep8_multi_cpp = \ - if [ -n "$(PEP8)" ]; then \ - for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \ + for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \ $(PEP8) $(PEP8_FLAGS) $$f.py; \ - done \ - fi + done +endif run_python = env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=.:$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(py_runme)