From 86db08ac88cbc267f8a7952f61ff80024b02a0a8 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Wed, 26 Dec 2012 23:55:51 +0000 Subject: [PATCH] Added __version__ attribute to the Cython module --- interfaces/cython/cantera/__init__.py | 1 + interfaces/cython/cantera/_cantera.pxd | 2 ++ interfaces/cython/cantera/utils.pyx | 2 ++ interfaces/cython/cantera/wrappers.h | 7 +++++++ 4 files changed, 12 insertions(+) diff --git a/interfaces/cython/cantera/__init__.py b/interfaces/cython/cantera/__init__.py index 85cb199d9..a70076b18 100644 --- a/interfaces/cython/cantera/__init__.py +++ b/interfaces/cython/cantera/__init__.py @@ -1,4 +1,5 @@ from ._cantera import * +from ._cantera import __version__ from .liquidvapor import * import os as _os diff --git a/interfaces/cython/cantera/_cantera.pxd b/interfaces/cython/cantera/_cantera.pxd index ba23f24ee..8e26bda34 100644 --- a/interfaces/cython/cantera/_cantera.pxd +++ b/interfaces/cython/cantera/_cantera.pxd @@ -424,6 +424,8 @@ cdef extern from "cantera/oneD/Sim1D.h": cdef extern from "wrappers.h": + # config definitions + cdef string get_cantera_version() # ThermoPhase composition cdef void thermo_getMassFractions(CxxThermoPhase*, double*) except + cdef void thermo_setMassFractions(CxxThermoPhase*, double*) except + diff --git a/interfaces/cython/cantera/utils.pyx b/interfaces/cython/cantera/utils.pyx index 106f1e18a..1650ee623 100644 --- a/interfaces/cython/cantera/utils.pyx +++ b/interfaces/cython/cantera/utils.pyx @@ -18,3 +18,5 @@ cdef pystr(string x): def addDirectory(directory): CxxAddDirectory(stringify(directory)) + +__version__ = pystr(get_cantera_version()) diff --git a/interfaces/cython/cantera/wrappers.h b/interfaces/cython/cantera/wrappers.h index c5dc3248d..5a90bcf47 100644 --- a/interfaces/cython/cantera/wrappers.h +++ b/interfaces/cython/cantera/wrappers.h @@ -1,6 +1,13 @@ #include "cantera/thermo/ThermoPhase.h" #include "cantera/transport/TransportBase.h" + +// Wrappers for preprocessor defines +std::string get_cantera_version() +{ + return std::string(CANTERA_VERSION); +} + // Function which populates a 1D array #define ARRAY_FUNC(PREFIX, CLASS_NAME, FUNC_NAME) \ void PREFIX ## _ ## FUNC_NAME(Cantera::CLASS_NAME* object, double* data) \