diff options
Diffstat (limited to 'Examples/test-suite/python/Makefile.in')
-rw-r--r-- | Examples/test-suite/python/Makefile.in | 94 |
1 files changed, 49 insertions, 45 deletions
diff --git a/Examples/test-suite/python/Makefile.in b/Examples/test-suite/python/Makefile.in index e7db32fb7..82a0e9db1 100644 --- a/Examples/test-suite/python/Makefile.in +++ b/Examples/test-suite/python/Makefile.in @@ -10,10 +10,13 @@ endif LANGUAGE = python PYTHON = $(PYBIN) +PEP8 = @PEP8@ +PEP8_FLAGS = --ignore=E402,E501,E30,W291,W391 #*_runme.py for Python 2.x, *_runme3.py for Python 3.x PY2SCRIPTSUFFIX = _runme.py PY3SCRIPTSUFFIX = _runme3.py +PY2TO3 = 2to3 -x import ifeq (,$(PY3)) SCRIPTSUFFIX = $(PY2SCRIPTSUFFIX) @@ -25,10 +28,6 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ - -PY2TO3 = 2to3 -x import - - CPP_TEST_CASES += \ argcargvtest \ callback \ @@ -41,7 +40,6 @@ CPP_TEST_CASES += \ inout \ inplaceadd \ input \ - kwargs_feature \ li_cstring \ li_cwstring \ li_factory \ @@ -88,82 +86,89 @@ C_TEST_CASES += \ include $(srcdir)/../common.mk -BUILTIN_BROKEN = \ - default_constructor.cpptest \ - director_exception.cpptest \ - exception_order.cpptest \ - li_std_string_extra.cpptest \ - li_std_wstring.cpptest \ - python_abstractbase.cpptest \ - threads_exception.cpptest - -BUILTIN_NOT_BROKEN = $(filter-out $(BUILTIN_BROKEN),$(NOT_BROKEN_TEST_CASES)) - -builtin-check : $(BUILTIN_NOT_BROKEN) - # Overridden variables here -LIBS = -L. +SCRIPTDIR = . +LIBS = -L. VALGRIND_OPT += --suppressions=pythonswig.supp # Custom tests - tests with additional commandline options # none! # Rules for the different types of tests -%.cpptest: +%.cpptest: +$(convert_testcase) $(setup) +$(swig_and_compile_cpp) + $(check_pep8) $(run_testcase) %.ctest: +$(convert_testcase) $(setup) +$(swig_and_compile_c) + $(check_pep8) $(run_testcase) -%.multicpptest: +%.multicpptest: +$(convert_testcase) $(setup) +$(swig_and_compile_multi_cpp) + $(check_pep8_multi_cpp) $(run_testcase) -# Call 2to3 to generate Python 3.x test from the Python 2.x's *_runme.py file -%$(PY3SCRIPTSUFFIX): %$(PY2SCRIPTSUFFIX) - cp $< $@ - $(PY2TO3) -w $@ >/dev/null 2>&1 - # 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. -run_python = env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=.:$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) +py_runme = $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) +py2_runme = $(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX) +py3_runme = $(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX) + +check_pep8 = \ + if [ -n "$(PEP8)" ]; then \ + $(PEP8) $(PEP8_FLAGS) $(SCRIPTPREFIX)$*.py;\ + fi + +check_pep8_multi_cpp = \ + if [ -n "$(PEP8)" ]; then \ + for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \ + $(PEP8) $(PEP8_FLAGS) $$f.py; \ + done \ + fi -py2_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX) -py3_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX) +run_python = env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=.:$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(py_runme) run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + if [ -f $(SCRIPTDIR)/$(py_runme) ]; then \ $(run_python);\ fi -ifeq (,$(PY3)) +# No copying/conversion needed for in-source-tree Python 2 scripts +ifeq ($(SCRIPTDIR)|$(SCRIPTSUFFIX),$(srcdir)|$(PY2SCRIPTSUFFIX)) convert_testcase = else + convert_testcase = \ - if [ -f $(py2_runme) ]; then \ - $(MAKE) -f $(srcdir)/Makefile $(py3_runme); \ + if [ -f $(srcdir)/$(py2_runme) ]; then \ + $(MAKE) $(SCRIPTDIR)/$(py_runme); \ fi + +$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX): $(srcdir)/$(SCRIPTPREFIX)%$(PY2SCRIPTSUFFIX) + test x$< = x$@ || cp $< $@ || exit 1 + test x$(PY3) = x || $(PY2TO3) -w $@ >/dev/null 2>&1 || exit 1 + endif # Clean: remove the generated .py file +# We only remove the _runme3.py if it is generated by 2to3 from a _runme.py. %.clean: - @rm -f $*.py; - @#We only remove the _runme3.py if it is generated by 2to3 from a _runme.py. - @if [ -f $(py2_runme) ]; then rm -f $(py3_runme) $(py3_runme).bak; fi + @rm -f $*.py + @if test -f $(srcdir)/$(py2_runme); then rm -f $(SCRIPTDIR)/$(py3_runme) $(SCRIPTDIR)/$(py3_runme).bak; fi + @if test "x$(SCRIPTDIR)" != "x$(srcdir)"; then rm -f $(SCRIPTDIR)/$(py2_runme); fi clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile python_clean + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" python_clean rm -f hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py rm -f clientdata_prop_a.py clientdata_prop_b.py import_stl_a.py import_stl_b.py rm -f imports_a.py imports_b.py mod_a.py mod_b.py multi_import_a.py @@ -172,12 +177,12 @@ clean: cvsignore: @echo '*wrap* *.pyc *.so *.dll *.exp *.lib' @echo Makefile - @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.py; done - @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.py CVS/Entries ; then echo $${i}_runme.py; fi; done - @echo clientdata_prop_a.py - @echo clientdata_prop_b.py - @echo imports_a.py - @echo imports_b.py + @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.py; done + @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.py CVS/Entries ; then echo $${i}_runme.py; fi; done + @echo clientdata_prop_a.py + @echo clientdata_prop_b.py + @echo imports_a.py + @echo imports_b.py @echo mod_a.py mod_b.py @echo hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py @echo template_typedef_import.py @@ -185,9 +190,8 @@ cvsignore: hugemod_runme = hugemod$(SCRIPTPREFIX) hugemod: - perl hugemod.pl $(hugemod_runme) + perl hugemod.pl $(hugemod_runme) $(MAKE) hugemod_a.cpptest $(MAKE) hugemod_b.cpptest sh -c "time $(PYTHON) $(hugemod_runme)" sh -c "time $(PYTHON) $(hugemod_runme)" - |