Commit fa47bdca3c245f2abd1f1b91a5ca0f49bd8b7fa3

Authored by Jürgen Knödlseder
1 parent e8d48779

Rename ctools.i to tools.i

.gitignore
... ... @@ -44,8 +44,8 @@ doc/man
44 44 src/ctools-setup
45 45 pyext/build/
46 46 pyext/setup.py
47   -pyext/ctools/ctools.py
48   -pyext/ctools/ctools_wrap.cpp
  47 +pyext/ctools/tools.py
  48 +pyext/ctools/tools_wrap.cpp
49 49 src/ctbin/ctbin
50 50 src/ctlike/ctlike
51 51 src/cttsmap/cttsmap
... ...
configure.ac
... ... @@ -522,8 +522,8 @@ AC_C_INLINE
522 522 #############################################################################
523 523 # Checks if Python bindings are to be build #
524 524 # ------------------------------------------------------------------------- #
525   -# Python binding requires Python and either the files ctools_wrap.cpp and #
526   -# ctools.py or swig to create these files. The following conditionals are #
  525 +# Python binding requires Python and either the files tools_wrap.cpp and #
  526 +# tools.py or swig to create these files. The following conditionals are #
527 527 # set: #
528 528 # WITH_PYTHON - Python bindings will be built #
529 529 # HAVE_SWIG - swig is available #
... ... @@ -628,9 +628,9 @@ else
628 628 has_swig="yes"
629 629 fi
630 630  
631   - # Do we have wrappers (ctools_wrap.cpp and ctools.py)?
  631 + # Do we have wrappers (tools_wrap.cpp and tools.py)?
632 632 has_wrappers="yes"
633   - AC_CHECK_FILES([pyext/ctools/ctools_wrap.cpp pyext/ctools/ctools.py],,
  633 + AC_CHECK_FILES([pyext/ctools/tools_wrap.cpp pyext/ctools/tools.py],,
634 634 [has_wrappers="no"])
635 635 if test "x$has_wrappers" = "xno"; then
636 636 AC_MSG_WARN([Python wrapper missing. Requires swig for wrapper generation.])
... ... @@ -669,9 +669,9 @@ if test "x$enable_python" = "xyes"; then
669 669  
670 670 else
671 671 if test "x$has_python_wrap" = "xno" -a "x$has_swig" = "xno"; then
672   - AC_MSG_WARN([Neither pyext/ctools/ctools_wrap.cpp and pyext/ctools/ctools.py nor swig has not been found])
  672 + AC_MSG_WARN([Neither pyext/ctools/tools_wrap.cpp and pyext/ctools/tools.py nor swig has not been found])
673 673 AC_MSG_WARN([Python binding for ctools cannot be built])
674   - AC_MSG_WARN([Either use a ctools distribution with ctools_wrap.cpp and ctools.py shipped or install swig on your system])
  674 + AC_MSG_WARN([Either use a ctools distribution with tools_wrap.cpp and tools.py shipped or install swig on your system])
675 675 AC_MSG_WARN([swig can be obtained from http://www.swig.org/])
676 676 fi
677 677 fi
... ...
pyext/Makefile.am
1 1 #############################################################################
2 2 # Makefile for ctools Python extension module #
3 3 # ------------------------------------------------------------------------- #
4   -# Copyright (C) 2011-2012 Juergen Knoedlseder #
  4 +# Copyright (C) 2011-2014 Juergen Knoedlseder #
5 5 # ------------------------------------------------------------------------- #
6 6 # #
7 7 # This program is free software: you can redistribute it and/or modify #
... ... @@ -30,7 +30,7 @@
30 30 if WITH_PYTHON
31 31  
32 32 # Set SWIG interface filename
33   -SWIG_INTERFACE = ctools/ctools.i
  33 +SWIG_INTERFACE = ctools/tools.i
34 34  
35 35 # Dependencies. Obtain the list of dependencies by executing ls.
36 36 DEPFILES = $(shell ls *.Pi 2> /dev/null)
... ... @@ -39,7 +39,7 @@ include $(DEPFILES)
39 39 # Define the targets that should be built before anything else.
40 40 # These are honored by 'make all', 'make check' and 'make install'.
41 41 if HAVE_SWIG
42   - BUILT_SOURCES = ctools/ctools_wrap.cpp ctools/ctools.py
  42 + BUILT_SOURCES = ctools/tools_wrap.cpp ctools/tools.py
43 43 endif
44 44  
45 45 # Set files to be removed in clean. We remove only the SWIG interface files
... ... @@ -59,21 +59,21 @@ all-local: build
59 59 # of this specific directory. So we build one instance for checking, the other
60 60 # for installation. If we could get the name built by distutils we could avoid
61 61 # this.
62   -build: ctools/ctools_wrap.cpp ctools/ctools.py
  62 +build: ctools/tools_wrap.cpp ctools/tools.py
63 63 $(PYTHON) setup.py build
64 64  
65 65 install-exec-local:
66 66 $(PYTHON) setup.py install --prefix=$(prefix)
67 67  
68 68 clean-local:
69   - rm -rf build _ctools.so
  69 + rm -rf build _tools.so
70 70  
71 71 # Rule for building Python wrappers using SWIG.
72 72 if HAVE_SWIG
73   -ctools/ctools.py: ctools/ctools_wrap.cpp
74   -ctools/ctools_wrap.cpp: $(SWIG_INTERFACE)
75   - if $(SWIGCOMPILE) -MMD -MF "ctools.Tpi" -o ctools/ctools_wrap.cpp $<; \
76   - then mv -f "ctools.Tpi" "ctools.Pi"; else rm -f "ctools.Tpi"; exit 1; fi
  73 +ctools/tools.py: ctools/tools_wrap.cpp
  74 +ctools/tools_wrap.cpp: $(SWIG_INTERFACE)
  75 + if $(SWIGCOMPILE) -MMD -MF "tools.Tpi" -o ctools/tools_wrap.cpp $<; \
  76 + then mv -f "tools.Tpi" "tools.Pi"; else rm -f "tools.Tpi"; exit 1; fi
77 77 endif # HAVE_SWIG
78 78  
79 79 endif # WITH_PYTHON
... ...
pyext/ctools/__init__.py
1   -from .ctools import *
  1 +# Import sub modules
  2 +from .tools import *
2 3 import obsutils
3 4  
  5 +# Remove swig register stuff
4 6 bad_entries = [entry for entry in list(locals())
5 7 if entry.endswith('_swigregister')]
6 8 for entry in bad_entries:
7 9 del locals()[entry]
8   -del gammalib
  10 +
  11 +# Clean-up
  12 +del tools
9 13 del ctools
  14 +del gammalib
  15 +del bad_entries
  16 +del entry
10 17 \ No newline at end of file
... ...
pyext/ctools/ctools.i renamed to pyext/ctools/tools.i
1 1 /***************************************************************************
2   - * ctools - SWIG file *
  2 + * ctools - SWIG file *
3 3 * ----------------------------------------------------------------------- *
4 4 * copyright (C) 2010-2014 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
... ... @@ -19,14 +19,14 @@
19 19 * *
20 20 * ----------------------------------------------------------------------- *
21 21 * Usage: *
22   - * swig -c++ -python -Wall ctools.i *
  22 + * swig -c++ -python -Wall tools.i *
23 23 ***************************************************************************/
24 24 /**
25   - * @file ctools.i
  25 + * @file tools.i
26 26 * @brief ctools SWIG file
27 27 * @author Juergen Knoedlseder
28 28 */
29   -%module ctools
  29 +%module tools
30 30 %feature("autodoc", "1");
31 31  
32 32 /* __ Headers needed for compilation _____________________________________ */
... ...
pyext/setup.py.in
1 1 #############################################################################
2 2 # Disutils setup file for ctools Python extension module #
3 3 # ------------------------------------------------------------------------- #
4   -# Copyright (C) 2011-2012 Juergen Knoedlseder #
  4 +# Copyright (C) 2011-2014 Juergen Knoedlseder #
5 5 # ------------------------------------------------------------------------- #
6 6 # #
7 7 # This program is free software: you can redistribute it and/or modify #
... ... @@ -18,7 +18,6 @@
18 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 19 # #
20 20 #############################################################################
21   -
22 21 from distutils.core import setup, Extension
23 22 from distutils import sysconfig
24 23 import glob
... ... @@ -122,8 +121,8 @@ setup(name=&#39;@PACKAGE_NAME@&#39;,
122 121 author='Juergen Knoedlseder',
123 122 author_email='@PACKAGE_BUGREPORT@',
124 123 url='http://gammalib.sourceforge.net/',
125   - py_modules=['ctools.ctools', 'ctools.obsutils'],
126   - ext_modules=[Extension('ctools._ctools', ['ctools/ctools_wrap.cpp'],
  124 + py_modules=['ctools.tools', 'ctools.obsutils'],
  125 + ext_modules=[Extension('ctools._tools', ['ctools/tools_wrap.cpp'],
127 126 include_dirs=include_dirs,
128 127 library_dirs=library_dirs,
129 128 libraries=libraries,
... ...