[Numpy-svn] r4457 - in branches/numpy.scons/numpy/distutils/scons/tests: . f2pyext

numpy-svn@scip... numpy-svn@scip...
Thu Nov 15 00:00:50 CST 2007


Author: cdavid
Date: 2007-11-15 00:00:42 -0600 (Thu, 15 Nov 2007)
New Revision: 4457

Added:
   branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/
   branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/SConstruct
   branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/setup.py
   branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/spam.pyf
Log:
Add a basic test for f2py

Added: branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/SConstruct
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/SConstruct	2007-11-15 05:57:42 UTC (rev 4456)
+++ branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/SConstruct	2007-11-15 06:00:42 UTC (rev 4457)
@@ -0,0 +1,8 @@
+# vim:syntax=python
+from numpy.distutils.scons import GetNumpyEnvironment
+from numpy.distutils.misc_util import get_numpy_include_dirs
+
+env = GetNumpyEnvironment(ARGUMENTS)
+
+env.Append(CPPPATH = get_numpy_include_dirs())
+env.NumpyPythonExtension('spam', source = ['spam.pyf'])

Added: branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/setup.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/setup.py	2007-11-15 05:57:42 UTC (rev 4456)
+++ branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/setup.py	2007-11-15 06:00:42 UTC (rev 4457)
@@ -0,0 +1,13 @@
+import os
+import os.path
+
+def configuration(parent_package='',top_path=None):
+    from numpy.distutils.misc_util import Configuration
+    config = Configuration('f2pyext',parent_package,top_path)
+
+    config.add_sconscript('SConstruct', source_files = ['spam.pyf.c'])
+    return config
+
+if __name__ == '__main__':
+    from numpy.distutils.core import setup
+    setup(configuration=configuration)

Added: branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/spam.pyf
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/spam.pyf	2007-11-15 05:57:42 UTC (rev 4456)
+++ branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/spam.pyf	2007-11-15 06:00:42 UTC (rev 4457)
@@ -0,0 +1,19 @@
+!    -*- f90 -*-
+python module spam
+    usercode '''
+  static char doc_spam_system[] = "Execute a shell command.";
+  static PyObject *spam_system(PyObject *self, PyObject *args)
+  {
+    char *command;
+    int sts;
+
+    if (!PyArg_ParseTuple(args, "s", &command))
+        return NULL;
+    sts = system(command);
+    return Py_BuildValue("i", sts);
+  }
+    '''
+    pymethoddef '''
+    {"system",  spam_system, METH_VARARGS, doc_spam_system},
+    '''
+end python module spam



More information about the Numpy-svn mailing list