Permalink
Browse files

Enable pep8 check

  • Loading branch information...
1 parent 6fe71da commit 7a4cef998c963bca49dd2403b024d6d69d87b80f @jschueller jschueller committed Jun 7, 2014
Showing with 22 additions and 12 deletions.
  1. +1 −0 .travis.yml
  2. +9 −0 Examples/test-suite/python/Makefile.in
  3. +11 −11 Examples/test-suite/python_append.i
  4. +1 −1 configure.ac
View
1 .travis.yml
@@ -64,6 +64,7 @@ before_install:
- if test "$SWIGLANG" = "lua"; then sudo apt-get -qq install lua5.1 liblua5.1-dev; fi
- if test "$SWIGLANG" = "octave"; then sudo apt-get -qq install octave3.2 octave3.2-headers; fi
- if test "$SWIGLANG" = "php"; then sudo apt-get install php5-cli php5-dev; fi
+ - if test "$SWIGLANG" = "python"; then sudo apt-get install -qq pep8; fi
- if test "$SWIGLANG" = "python" -a "$PY3" -a -z "$VER"; then sudo apt-get install -qq python3-dev; fi
- if test "$SWIGLANG" = "python" -a "$VER"; then sudo add-apt-repository -y ppa:fkrull/deadsnakes && sudo apt-get -qq update && sudo apt-get -qq install python${VER}-dev && export CONFIGOPTS="--with-python${PY3}=python${VER}"; fi
- if test "$SWIGLANG" = "tcl"; then sudo apt-get -qq install tcl8.4-dev; fi
View
9 Examples/test-suite/python/Makefile.in
@@ -10,6 +10,7 @@ endif
LANGUAGE = python
PYTHON = $(PYBIN)
+PEP8 = @PEP8@
#*_runme.py for Python 2.x, *_runme3.py for Python 3.x
PY2SCRIPTSUFFIX = _runme.py
@@ -111,12 +112,14 @@ VALGRIND_OPT += --suppressions=pythonswig.supp
+$(convert_testcase)
$(setup)
+$(swig_and_compile_cpp)
+ $(check_pep8)
$(run_testcase)
%.ctest:
+$(convert_testcase)
$(setup)
+$(swig_and_compile_c)
+ $(check_pep8)
$(run_testcase)
%.multicpptest:
@@ -126,13 +129,19 @@ VALGRIND_OPT += --suppressions=pythonswig.supp
$(run_testcase)
+
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.py (or _runme3.py for Python 3) appended after the testcase name.
py_runme = $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)
py2_runme = $(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX)
py3_runme = $(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX)
+check_pep8 = \
+ if [ -n "$(PEP8)" ]; then \
+ $(PEP8) --ignore=E501,E30,W291,W391 `echo $(py2_runme)|sed "s|_runme||g"`;\
+ fi
+
run_python = env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=.:$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(py_runme)
run_testcase = \
View
22 Examples/test-suite/python_append.i
@@ -5,22 +5,22 @@ Testcase to test %pythonprepend and %pythonappend %pythoncode %pythonbegin
%module python_append
%pythoncode %{
- mypath = os.path.dirname("/a/b/c/d.txt")
- funcpath = None
- staticfuncpath = None
- def grabpath():
+mypath = os.path.dirname("/a/b/c/d.txt")
+funcpath = None
+staticfuncpath = None
+def grabpath():
return funcpath
- def grabstaticpath():
+def grabstaticpath():
return staticfuncpath
%}
%pythonappend Test::func %{
- funcpath = os.path.dirname(funcpath)
+funcpath = os.path.dirname(funcpath)
%}
%pythonprepend Test::func %{
- global funcpath
- funcpath = mypath
+global funcpath
+funcpath = mypath
%}
%pythonappend Test::static_func %{
@@ -29,9 +29,9 @@ pass
%}
%pythonprepend Test::static_func {
- global staticfuncpath
- staticfuncpath = mypath
- pass
+global staticfuncpath
+staticfuncpath = mypath
+pass
}
%pythonbegin %{
View
2 configure.ac
@@ -789,7 +789,7 @@ AC_SUBST(PY3INCLUDE)
AC_SUBST(PY3LIB)
AC_SUBST(PY3LINK)
AC_SUBST(PYTHON3DYNAMICLINKING)
-
+AC_CHECK_PROGS(PEP8, pep8)
#----------------------------------------------------------------
# Look for Perl5

0 comments on commit 7a4cef9

Please sign in to comment.