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