[Numpy-svn] r4078 - in branches/numpy.scons/numpy: distutils/scons scons_fake

numpy-svn@scip... numpy-svn@scip...
Sat Sep 22 08:48:12 CDT 2007


Author: cdavid
Date: 2007-09-22 08:47:45 -0500 (Sat, 22 Sep 2007)
New Revision: 4078

Modified:
   branches/numpy.scons/numpy/distutils/scons/__init__.py
   branches/numpy.scons/numpy/scons_fake/SConstruct
   branches/numpy.scons/numpy/scons_fake/__init__.py
   branches/numpy.scons/numpy/scons_fake/foo.c
Log:
Add a CTypesBuilder which does not install exp/lib files on windows

Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/__init__.py	2007-09-22 11:55:05 UTC (rev 4077)
+++ branches/numpy.scons/numpy/distutils/scons/__init__.py	2007-09-22 13:47:45 UTC (rev 4078)
@@ -13,7 +13,17 @@
 
     inst_lib = env.Install("$distutils_installdir", lib)
     return lib, inst_lib
+	
+	
+def NumpyCTypes(env, target, source, *args, **kw):
+    source = [pjoin(env['build_dir'], i) for i in source]
+    # XXX: why target is a list ? It is always true ?
+    lib = env.SharedLibrary("$build_dir/%s" % target[0], source, *args, **kw)
+    lib = [i for i in lib if not (str(i).endswith('.exp') or str(i).endswith('.lib')) ]
+    inst_lib = env.Install("$distutils_installdir", lib)
+    return lib, inst_lib
 
+
 def GetNumpyOptions(args):
     """Call this with args=ARGUMENTS to take into account command line args."""
     opts = Options(None, args)
@@ -36,6 +46,7 @@
                                                   env['pkg_name']))
 
     env['BUILDERS']['NumpySharedLibrary'] = NumpySharedLibrary
+    env['BUILDERS']['NumpyCTypes'] = NumpyCTypes
     print env['src_dir']
     if len(env['src_dir']) > 0:
         BuildDir(env['build_dir'], env['src_dir'])

Modified: branches/numpy.scons/numpy/scons_fake/SConstruct
===================================================================
--- branches/numpy.scons/numpy/scons_fake/SConstruct	2007-09-22 11:55:05 UTC (rev 4077)
+++ branches/numpy.scons/numpy/scons_fake/SConstruct	2007-09-22 13:47:45 UTC (rev 4078)
@@ -9,4 +9,4 @@
 config.Finish()
 
 source = ['foo.c']
-env.NumpySharedLibrary('foo', source)
+env.NumpyCTypes('foo', source)

Modified: branches/numpy.scons/numpy/scons_fake/__init__.py
===================================================================
--- branches/numpy.scons/numpy/scons_fake/__init__.py	2007-09-22 11:55:05 UTC (rev 4077)
+++ branches/numpy.scons/numpy/scons_fake/__init__.py	2007-09-22 13:47:45 UTC (rev 4078)
@@ -1,6 +1,6 @@
 from numpy.ctypeslib import load_library
 
-_FOO = load_library("libfoo.so", __file__)
+_FOO = load_library("foo.dll", __file__)
 def foo():
     _FOO.foo()
     

Modified: branches/numpy.scons/numpy/scons_fake/foo.c
===================================================================
--- branches/numpy.scons/numpy/scons_fake/foo.c	2007-09-22 11:55:05 UTC (rev 4077)
+++ branches/numpy.scons/numpy/scons_fake/foo.c	2007-09-22 13:47:45 UTC (rev 4078)
@@ -1,6 +1,13 @@
 #include <stdio.h>
 
-int foo(void)
+#ifdef WIN32
+#define FOO_EXPORT __declspec(dllexport)
+#else
+#define FOO_EXPORT 
+#endif
+
+int FOO_EXPORT foo(void)
 {
         printf("hello\n");
+		return 0;
 }



More information about the Numpy-svn mailing list