diff options
Diffstat (limited to 'Examples/test-suite/python/Makefile.in')
-rw-r--r-- | Examples/test-suite/python/Makefile.in | 84 |
1 files changed, 69 insertions, 15 deletions
diff --git a/Examples/test-suite/python/Makefile.in b/Examples/test-suite/python/Makefile.in index 7f11cd495..b8bd8944c 100644 --- a/Examples/test-suite/python/Makefile.in +++ b/Examples/test-suite/python/Makefile.in @@ -2,16 +2,37 @@ # Makefile for python test-suite ####################################################################### +ifeq (,$(PY3)) + PYBIN = @PYTHON@ +else + PYBIN = @PYTHON3@ +endif + LANGUAGE = python -PYTHON = @PYTHON@ -SCRIPTSUFFIX = _runme.py +PYTHON = $(PYBIN) + +#*_runme.py for Python 2.x, *_runme3.py for Python 3.x +PY2SCRIPTSUFFIX = _runme.py +PY3SCRIPTSUFFIX = _runme3.py + +ifeq (,$(PY3)) + SCRIPTSUFFIX = $(PY2SCRIPTSUFFIX) +else + SCRIPTSUFFIX = $(PY3SCRIPTSUFFIX) +endif + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ + +PY2TO3 = 2to3 -x import + + CPP_TEST_CASES += \ argcargvtest \ - autodoc \ + python_autodoc \ + python_append \ callback \ complextest \ director_stl \ @@ -22,32 +43,39 @@ CPP_TEST_CASES += \ input \ inplaceadd \ implicittest \ - kwargs \ li_cstring \ li_cwstring \ li_factory \ li_implicit \ li_std_vectora \ + li_std_vector_extra \ li_std_map \ + li_std_multimap \ + li_std_pair_extra \ li_std_set \ li_std_stream \ + li_std_string_extra \ li_std_wstream \ li_std_wstring \ - nondynamic \ - overload_simple_cast \ primitive_types \ + python_abstractbase \ + python_kwargs \ + python_nondynamic \ + python_overload_simple_cast \ std_containers \ swigobject \ template_matrix \ - simutry \ - vector + simutry +# li_std_carray +# director_profile +# python_pybuf C_TEST_CASES += \ file_test \ li_cstring \ li_cwstring \ - nondynamic + python_nondynamic # # This test only works with modern C compilers @@ -77,17 +105,42 @@ VALGRIND_OPT += --suppressions=pythonswig.supp +$(swig_and_compile_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 appended after the testcase name. +# 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) + +py2_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX) +py3_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX) + +ifeq (,$(PY3)) run_testcase = \ if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \ - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \ + $(run_python);)\ + fi; +else +run_testcase = \ + if [ -f $(py2_runme) ]; then ( \ + $(MAKE) -f $(srcdir)/Makefile $(py3_runme) && \ + $(run_python);) \ + elif [ -f $(py3_runme) ]; then ( \ + $(run_python);) \ fi; +endif # Clean: remove the generated .py file %.clean: @rm -f hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py @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; clean: $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile python_clean @@ -101,14 +154,15 @@ cvsignore: @echo clientdata_prop_b.py @echo imports_a.py @echo imports_b.py - @echo mod_a.py mod_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 +hugemod_runme = hugemod$(SCRIPTPREFIX) hugemod: - perl hugemod.pl + perl hugemod.pl $(hugemod_runme) $(MAKE) hugemod_a.cpptest $(MAKE) hugemod_b.cpptest - time $(PYTHON) hugemod_runme.py - time $(PYTHON) hugemod_runme.py + sh -c "time $(PYTHON) $(hugemod_runme)" + sh -c "time $(PYTHON) $(hugemod_runme)" |