[Scipy-svn] r5392 - trunk/scipy/linalg

scipy-svn@scip... scipy-svn@scip...
Thu Jan 8 06:36:56 CST 2009


Author: cdavid
Date: 2009-01-08 06:36:51 -0600 (Thu, 08 Jan 2009)
New Revision: 5392

Modified:
   trunk/scipy/linalg/atlas_version.c
Log:
Do not display atlas build info when importing atlas_version; add a function which does so instead.

Modified: trunk/scipy/linalg/atlas_version.c
===================================================================
--- trunk/scipy/linalg/atlas_version.c	2009-01-08 12:31:22 UTC (rev 5391)
+++ trunk/scipy/linalg/atlas_version.c	2009-01-08 12:36:51 UTC (rev 5392)
@@ -1,24 +1,33 @@
-#ifdef __CPLUSPLUS__
-extern "C" {
-#endif
 #include "Python.h"
-static PyMethodDef module_methods[] = { {NULL,NULL} };
-PyMODINIT_FUNC initatlas_version(void) {
-  PyObject *m = NULL;
+
+static PyObject* version(PyObject* self, PyObject* dummy)
+{
 #if defined(NO_ATLAS_INFO)
-  printf("NO ATLAS INFO AVAILABLE\n");
+    printf("NO ATLAS INFO AVAILABLE\n");
 #else
-  void ATL_buildinfo(void);
-  ATL_buildinfo();
+    void ATL_buildinfo(void);
+    ATL_buildinfo();
 #endif
-  m = Py_InitModule("atlas_version", module_methods);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+static char version_doc[] = "Print the build info from atlas.";
+
+static PyMethodDef module_methods[] = {
+    {"version", version, METH_VARARGS, version_doc},
+    {NULL, NULL, 0, NULL}
+};
+
+PyMODINIT_FUNC initatlas_version(void)
+{
+    PyObject *m = NULL;
+    m = Py_InitModule("atlas_version", module_methods);
 #if defined(ATLAS_INFO)
-  {
-    PyObject *d = PyModule_GetDict(m);
-    PyDict_SetItemString(d,"ATLAS_VERSION",PyString_FromString(ATLAS_INFO));
-  }
+    {
+        PyObject *d = PyModule_GetDict(m);
+        PyDict_SetItemString(d,"ATLAS_VERSION",PyString_FromString(ATLAS_INFO));
+    }
 #endif
 }
-#ifdef __CPLUSCPLUS__
-}
-#endif



More information about the Scipy-svn mailing list