diff --git a/interfaces/python/Cantera/__init__.py b/interfaces/python/Cantera/__init__.py index 4e6e985d6..cf499e42c 100755 --- a/interfaces/python/Cantera/__init__.py +++ b/interfaces/python/Cantera/__init__.py @@ -15,6 +15,8 @@ from importFromFile import * import os as _os import sys as _sys +__version__ = _cantera.ct_get_version() + import warnings warnings.warn( "\nThis version of the Cantera Python module is deprecated and will not be\n" diff --git a/src/python/ctfuncs.cpp b/src/python/ctfuncs.cpp index 2d2916c74..c3edc6344 100644 --- a/src/python/ctfuncs.cpp +++ b/src/python/ctfuncs.cpp @@ -101,7 +101,7 @@ ct_writelogfile(PyObject* self, PyObject* args) return Py_BuildValue("i",iok); } - - - - +static PyObject* ct_get_version(PyObject* self, PyObject* args) +{ + return Py_BuildValue("s",std::string(CANTERA_VERSION).c_str()); +} diff --git a/src/python/methods.h b/src/python/methods.h index 411633f8f..42da26e20 100644 --- a/src/python/methods.h +++ b/src/python/methods.h @@ -91,6 +91,7 @@ static PyMethodDef ct_methods[] = { {"ct_refcnt", ct_refcnt, METH_VARARGS}, {"ct_ck2cti", ct_ck2cti, METH_VARARGS}, {"ct_writelogfile", ct_writelogfile, METH_VARARGS}, + {"ct_get_version", ct_get_version, METH_VARARGS}, //{"readlog", ct_readlog, METH_VARARGS}, //{"buildSolutionFromXML", ct_buildSolutionFromXML, METH_VARARGS},