[Debian-astro-commits] [gyoto] 194/221: Python: make Swig interface file language agnostic (by including NumPy lines only conditionaly)
Thibaut Jean-Claude Paumard
thibaut at moszumanska.debian.org
Fri May 22 20:52:46 UTC 2015
This is an automated email from the git hooks/post-receive script.
thibaut pushed a commit to branch master
in repository gyoto.
commit ca3d163e0780d3ad171d51ed37d07fa770fbf230
Author: Thibaut Paumard <paumard at users.sourceforge.net>
Date: Wed Jan 14 16:05:13 2015 +0100
Python: make Swig interface file language agnostic (by including NumPy lines only conditionaly)
---
python/gyoto.i | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/python/gyoto.i b/python/gyoto.i
index 4b04480..3ee7405 100644
--- a/python/gyoto.i
+++ b/python/gyoto.i
@@ -215,7 +215,9 @@ using namespace Gyoto;
// This will be called upon extension initialization
%init {
Gyoto::Register::init();
+#ifdef SWIGPYTHON
import_array();
+#endif
}
// Rename operator++() -> increment() for everything
@@ -419,16 +421,19 @@ GyotoSmPtrTypeMapClassDerived(Astrobj, Properties);
%}
%template(vector_unsigned_long) std::vector<unsigned long>;
+#ifdef SWIGPYTHON
// Handle some arrays as NumPy arrays
%include "numpy.i";
%numpy_typemaps(size_t, NPY_ULONG , size_t);
%numpy_typemaps(double, NPY_DOUBLE, size_t);
+#endif
// Handle generic C arrays using a class-like interface
%include "carrays.i"
%array_class(double, array_double);
%array_class(size_t, array_size_t);
%array_class(unsigned long, array_unsigned_long);
+#ifdef SWIGPYTHON
// Provide conversion between generic C arrays and NumPy ndarrays
%define ExtendArrayNumPy(name, type)
%extend name {
@@ -450,6 +455,7 @@ GyotoSmPtrTypeMapClassDerived(Astrobj, Properties);
ExtendArrayNumPy(array_double, double);
ExtendArrayNumPy(array_unsigned_long, unsigned long);
ExtendArrayNumPy(array_size_t, size_t);
+#endif
// ******** INTERFACE ******** //
// Here starts the actual parsing of the various header files
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/gyoto.git
More information about the Debian-astro-commits
mailing list