Commit ad3d797087c8f36cf1dd8c4182ff0da705a2cfcc

Authored by knodlseder
1 parent e0e5b18c

initial version

pyext/Makefile.am 0 → 100755
  1 +## Process this file with automake to produce Makefile.in
  2 +
  3 +if HAVE_SWIG
  4 +if HAVE_PYTHON
  5 +if ENABLE_PYTHON_BINDING
  6 +
  7 +SWIG_INTERFACE = ctatools.i
  8 +BUILT_SOURCES = ctatools_wrap.cpp ctatools.py
  9 +CLEANFILES = ctatools_wrap.cpp ctatools.py
  10 +
  11 +all-local: ctatools_wrap.cpp ctatools.py
  12 + $(PYTHON) setup.py build
  13 +
  14 +install-exec-local:
  15 + $(PYTHON) setup.py install --prefix=$(prefix)
  16 +
  17 +clean-local:
  18 + rm -rf build
  19 +
  20 +ctatools_wrap.cpp ctatools.py: $(SWIG_INTERFACE)
  21 + $(SWIG) -c++ -python -Wall -includeall -I$(prefix)/share/gammalib/swig -o ctatools_wrap.cpp -outdir . $(srcdir)/$(SWIG_INTERFACE)
  22 + @if test "x`uname`" = "xCygwin"; then \
  23 + echo "WARNING: working around bug in SWIG on Windows/Cygwin platforms ONLY"; \
  24 + sed -i.bak -f $(srcdir)/fix_wrapper.sed ctatools_wrap.cpp; \
  25 + fi
  26 +
  27 +endif # ENABLE_PYTHON_BINDING
  28 +endif # HAVE_PYTHON
  29 +endif # HAVE_SWIG
... ...
pyext/ctatools.i 0 → 100755
  1 +/***************************************************************************
  2 + * ctatools - SWIG file *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
  5 + * ----------------------------------------------------------------------- *
  6 + * *
  7 + * This program is free software; you can redistribute it and/or modify *
  8 + * it under the terms of the GNU General Public License as published by *
  9 + * the Free Software Foundation; either version 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + * ----------------------------------------------------------------------- *
  13 + * Usage: *
  14 + * swig -c++ -python -Wall -includeall ctatools.i *
  15 + ***************************************************************************/
  16 +%module ctatools
  17 +
  18 +/***********************************************************************//**
  19 + * @brief Include all CTA tools
  20 + ***************************************************************************/
  21 +#include "ctselect.i"
  22 +#include "ctbin.i"
  23 +#include "ctlike.i"
... ...
pyext/ctbin.i 0 → 100644
  1 +/***************************************************************************
  2 + * ctbin - CTA data binning tool *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
  5 + * ----------------------------------------------------------------------- *
  6 + * *
  7 + * This program is free software; you can redistribute it and/or modify *
  8 + * it under the terms of the GNU General Public License as published by *
  9 + * the Free Software Foundation; either version 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file ctbin.i
  15 + * @brief CTA data binning tool SWIG definition
  16 + * @author J. Knodlseder
  17 + */
  18 +%{
  19 +/* Put headers and other declarations here that are needed for compilation */
  20 +#include "ctbin.hpp"
  21 +%}
  22 +%include gammalib.i
  23 +
  24 +
  25 +/***********************************************************************//**
  26 + * @class ctbin
  27 + *
  28 + * @brief CTA data binning tool SWIG interface defintion.
  29 + ***************************************************************************/
  30 +class ctbin : public GApplication {
  31 +public:
  32 + // Constructors and destructors
  33 + ctbin(void) : GApplication(CTBIN_NAME, CTBIN_VERSION) { return; }
  34 +
  35 + // Methods
  36 + int run(void);
  37 +};
  38 +
  39 +
  40 +/***********************************************************************//**
  41 + * @brief CTA data binning tool SWIG extension
  42 + ***************************************************************************/
  43 +%extend ctbin {
  44 + ctbin copy() {
  45 + return (*self);
  46 + }
  47 +}
... ...
pyext/ctselect.i 0 → 100644
  1 +/***************************************************************************
  2 + * ctselect - CTA data selection tool *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
  5 + * ----------------------------------------------------------------------- *
  6 + * *
  7 + * This program is free software; you can redistribute it and/or modify *
  8 + * it under the terms of the GNU General Public License as published by *
  9 + * the Free Software Foundation; either version 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file ctselect.i
  15 + * @brief CTA data selection tool SWIG definition
  16 + * @author J. Knodlseder
  17 + */
  18 +%{
  19 +/* Put headers and other declarations here that are needed for compilation */
  20 +#include "ctselect.hpp"
  21 +%}
  22 +%include gammalib.i
  23 +
  24 +
  25 +/***********************************************************************//**
  26 + * @class ctselect
  27 + *
  28 + * @brief CTA data selection tool SWIG interface defintion.
  29 + ***************************************************************************/
  30 +class ctselect : public GApplication {
  31 +public:
  32 + // Constructors and destructors
  33 + ctselect(void) : GApplication(CTSELECT_NAME, CTSELECT_VERSION) { return; }
  34 +
  35 + // Methods
  36 + int run(void);
  37 +};
  38 +
  39 +
  40 +/***********************************************************************//**
  41 + * @brief CTA data selection tool SWIG extension
  42 + ***************************************************************************/
  43 +%extend ctselect {
  44 + ctselect copy() {
  45 + return (*self);
  46 + }
  47 +}
... ...
pyext/setup.py.in 0 → 100644
  1 +from distutils.core import setup, Extension
  2 +setup(name='@PACKAGE_NAME@',
  3 + version='@PACKAGE_VERSION@',
  4 + description='ctatools Python binding',
  5 + author='Jurgen Knodlseder',
  6 + author_email='@PACKAGE_BUGREPORT@',
  7 + url='http://gammalib.sourceforge.net/',
  8 + py_modules=['ctatools'],
  9 + ext_modules=[Extension('_ctatools', ['ctatools_wrap.cpp'],
  10 + include_dirs=['@prefix@/include/gammalib', '@top_srcdir@/src/ctbin', '@top_srcdir@/src/ctselect'],
  11 + library_dirs=['@prefix@/lib'],
  12 + libraries=['ctatools','gamma','cfitsio'],
  13 + runtime_library_dirs=['@prefix@/lib'])],
  14 + )
... ...