From fa47bdca3c245f2abd1f1b91a5ca0f49bd8b7fa3 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Mon, 27 Oct 2014 22:22:00 +0100 Subject: [PATCH] Rename ctools.i to tools.i --- .gitignore | 4 ++-- configure.ac | 12 ++++++------ pyext/Makefile.am | 18 +++++++++--------- pyext/ctools/__init__.py | 11 +++++++++-- pyext/ctools/ctools.i | 60 ------------------------------------------------------------ pyext/ctools/tools.i | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ pyext/setup.py.in | 7 +++---- 7 files changed, 89 insertions(+), 83 deletions(-) delete mode 100755 pyext/ctools/ctools.i create mode 100755 pyext/ctools/tools.i diff --git a/.gitignore b/.gitignore index d1de7f9..d8a9eab 100644 --- a/.gitignore +++ b/.gitignore @@ -44,8 +44,8 @@ doc/man src/ctools-setup pyext/build/ pyext/setup.py -pyext/ctools/ctools.py -pyext/ctools/ctools_wrap.cpp +pyext/ctools/tools.py +pyext/ctools/tools_wrap.cpp src/ctbin/ctbin src/ctlike/ctlike src/cttsmap/cttsmap diff --git a/configure.ac b/configure.ac index ac683df..5902825 100644 --- a/configure.ac +++ b/configure.ac @@ -522,8 +522,8 @@ AC_C_INLINE ############################################################################# # Checks if Python bindings are to be build # # ------------------------------------------------------------------------- # -# Python binding requires Python and either the files ctools_wrap.cpp and # -# ctools.py or swig to create these files. The following conditionals are # +# Python binding requires Python and either the files tools_wrap.cpp and # +# tools.py or swig to create these files. The following conditionals are # # set: # # WITH_PYTHON - Python bindings will be built # # HAVE_SWIG - swig is available # @@ -628,9 +628,9 @@ else has_swig="yes" fi - # Do we have wrappers (ctools_wrap.cpp and ctools.py)? + # Do we have wrappers (tools_wrap.cpp and tools.py)? has_wrappers="yes" - AC_CHECK_FILES([pyext/ctools/ctools_wrap.cpp pyext/ctools/ctools.py],, + AC_CHECK_FILES([pyext/ctools/tools_wrap.cpp pyext/ctools/tools.py],, [has_wrappers="no"]) if test "x$has_wrappers" = "xno"; then AC_MSG_WARN([Python wrapper missing. Requires swig for wrapper generation.]) @@ -669,9 +669,9 @@ if test "x$enable_python" = "xyes"; then else if test "x$has_python_wrap" = "xno" -a "x$has_swig" = "xno"; then - AC_MSG_WARN([Neither pyext/ctools/ctools_wrap.cpp and pyext/ctools/ctools.py nor swig has not been found]) + AC_MSG_WARN([Neither pyext/ctools/tools_wrap.cpp and pyext/ctools/tools.py nor swig has not been found]) AC_MSG_WARN([Python binding for ctools cannot be built]) - AC_MSG_WARN([Either use a ctools distribution with ctools_wrap.cpp and ctools.py shipped or install swig on your system]) + AC_MSG_WARN([Either use a ctools distribution with tools_wrap.cpp and tools.py shipped or install swig on your system]) AC_MSG_WARN([swig can be obtained from http://www.swig.org/]) fi fi diff --git a/pyext/Makefile.am b/pyext/Makefile.am index 9b2d2ce..4d6ccc8 100755 --- a/pyext/Makefile.am +++ b/pyext/Makefile.am @@ -1,7 +1,7 @@ ############################################################################# # Makefile for ctools Python extension module # # ------------------------------------------------------------------------- # -# Copyright (C) 2011-2012 Juergen Knoedlseder # +# Copyright (C) 2011-2014 Juergen Knoedlseder # # ------------------------------------------------------------------------- # # # # This program is free software: you can redistribute it and/or modify # @@ -30,7 +30,7 @@ if WITH_PYTHON # Set SWIG interface filename -SWIG_INTERFACE = ctools/ctools.i +SWIG_INTERFACE = ctools/tools.i # Dependencies. Obtain the list of dependencies by executing ls. DEPFILES = $(shell ls *.Pi 2> /dev/null) @@ -39,7 +39,7 @@ include $(DEPFILES) # Define the targets that should be built before anything else. # These are honored by 'make all', 'make check' and 'make install'. if HAVE_SWIG - BUILT_SOURCES = ctools/ctools_wrap.cpp ctools/ctools.py + BUILT_SOURCES = ctools/tools_wrap.cpp ctools/tools.py endif # Set files to be removed in clean. We remove only the SWIG interface files @@ -59,21 +59,21 @@ all-local: build # of this specific directory. So we build one instance for checking, the other # for installation. If we could get the name built by distutils we could avoid # this. -build: ctools/ctools_wrap.cpp ctools/ctools.py +build: ctools/tools_wrap.cpp ctools/tools.py $(PYTHON) setup.py build install-exec-local: $(PYTHON) setup.py install --prefix=$(prefix) clean-local: - rm -rf build _ctools.so + rm -rf build _tools.so # Rule for building Python wrappers using SWIG. if HAVE_SWIG -ctools/ctools.py: ctools/ctools_wrap.cpp -ctools/ctools_wrap.cpp: $(SWIG_INTERFACE) - if $(SWIGCOMPILE) -MMD -MF "ctools.Tpi" -o ctools/ctools_wrap.cpp $<; \ - then mv -f "ctools.Tpi" "ctools.Pi"; else rm -f "ctools.Tpi"; exit 1; fi +ctools/tools.py: ctools/tools_wrap.cpp +ctools/tools_wrap.cpp: $(SWIG_INTERFACE) + if $(SWIGCOMPILE) -MMD -MF "tools.Tpi" -o ctools/tools_wrap.cpp $<; \ + then mv -f "tools.Tpi" "tools.Pi"; else rm -f "tools.Tpi"; exit 1; fi endif # HAVE_SWIG endif # WITH_PYTHON diff --git a/pyext/ctools/__init__.py b/pyext/ctools/__init__.py index 1d6af6e..c9d32d9 100644 --- a/pyext/ctools/__init__.py +++ b/pyext/ctools/__init__.py @@ -1,9 +1,16 @@ -from .ctools import * +# Import sub modules +from .tools import * import obsutils +# Remove swig register stuff bad_entries = [entry for entry in list(locals()) if entry.endswith('_swigregister')] for entry in bad_entries: del locals()[entry] -del gammalib + +# Clean-up +del tools del ctools +del gammalib +del bad_entries +del entry \ No newline at end of file diff --git a/pyext/ctools/ctools.i b/pyext/ctools/ctools.i deleted file mode 100755 index f84bd71..0000000 --- a/pyext/ctools/ctools.i +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * ctools - SWIG file * - * ----------------------------------------------------------------------- * - * copyright (C) 2010-2014 by Juergen Knoedlseder * - * ----------------------------------------------------------------------- * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * * - * ----------------------------------------------------------------------- * - * Usage: * - * swig -c++ -python -Wall ctools.i * - ***************************************************************************/ -/** - * @file ctools.i - * @brief ctools SWIG file - * @author Juergen Knoedlseder - */ -%module ctools -%feature("autodoc", "1"); - -/* __ Headers needed for compilation _____________________________________ */ -%{ -#include -%} - -/* __ Include standard typemaps for vectors and strings __________________ */ -%include stl.i - -/* __ Make sure that exceptions are catched ______________________________ */ -%import(module="gammalib.support") "GException.i"; - -/* __ Inform about base classes __________________________________________ */ -%import(module="gammalib.base") "GBase.i"; -%import(module="gammalib.app") "GApplication.i"; - -/* __ ctools _____________________________________________________________ */ -%include "ctool.i" -%include "ctbin.i" -%include "ctobssim.i" -%include "ctlike.i" -%include "ctmodel.i" -%include "ctselect.i" -%include "ctskymap.i" -%include "ctexpcube.i" -%include "ctpsfcube.i" -%include "ctbkgcube.i" -%include "ctcubemask.i" -%include "cttsmap.i" -%include "ctbutterfly.i" diff --git a/pyext/ctools/tools.i b/pyext/ctools/tools.i new file mode 100755 index 0000000..7d75cf1 --- /dev/null +++ b/pyext/ctools/tools.i @@ -0,0 +1,60 @@ +/*************************************************************************** + * ctools - SWIG file * + * ----------------------------------------------------------------------- * + * copyright (C) 2010-2014 by Juergen Knoedlseder * + * ----------------------------------------------------------------------- * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + * ----------------------------------------------------------------------- * + * Usage: * + * swig -c++ -python -Wall tools.i * + ***************************************************************************/ +/** + * @file tools.i + * @brief ctools SWIG file + * @author Juergen Knoedlseder + */ +%module tools +%feature("autodoc", "1"); + +/* __ Headers needed for compilation _____________________________________ */ +%{ +#include +%} + +/* __ Include standard typemaps for vectors and strings __________________ */ +%include stl.i + +/* __ Make sure that exceptions are catched ______________________________ */ +%import(module="gammalib.support") "GException.i"; + +/* __ Inform about base classes __________________________________________ */ +%import(module="gammalib.base") "GBase.i"; +%import(module="gammalib.app") "GApplication.i"; + +/* __ ctools _____________________________________________________________ */ +%include "ctool.i" +%include "ctbin.i" +%include "ctobssim.i" +%include "ctlike.i" +%include "ctmodel.i" +%include "ctselect.i" +%include "ctskymap.i" +%include "ctexpcube.i" +%include "ctpsfcube.i" +%include "ctbkgcube.i" +%include "ctcubemask.i" +%include "cttsmap.i" +%include "ctbutterfly.i" diff --git a/pyext/setup.py.in b/pyext/setup.py.in index cafbbf8..e743ec1 100644 --- a/pyext/setup.py.in +++ b/pyext/setup.py.in @@ -1,7 +1,7 @@ ############################################################################# # Disutils setup file for ctools Python extension module # # ------------------------------------------------------------------------- # -# Copyright (C) 2011-2012 Juergen Knoedlseder # +# Copyright (C) 2011-2014 Juergen Knoedlseder # # ------------------------------------------------------------------------- # # # # This program is free software: you can redistribute it and/or modify # @@ -18,7 +18,6 @@ # along with this program. If not, see . # # # ############################################################################# - from distutils.core import setup, Extension from distutils import sysconfig import glob @@ -122,8 +121,8 @@ setup(name='@PACKAGE_NAME@', author='Juergen Knoedlseder', author_email='@PACKAGE_BUGREPORT@', url='http://gammalib.sourceforge.net/', - py_modules=['ctools.ctools', 'ctools.obsutils'], - ext_modules=[Extension('ctools._ctools', ['ctools/ctools_wrap.cpp'], + py_modules=['ctools.tools', 'ctools.obsutils'], + ext_modules=[Extension('ctools._tools', ['ctools/tools_wrap.cpp'], include_dirs=include_dirs, library_dirs=library_dirs, libraries=libraries, -- libgit2 0.21.4