[Numpy-svn] r4238 - branches/numpy.scons/numpy/random

numpy-svn at scipy.org numpy-svn at scipy.org
Thu Oct 18 09:35:32 EDT 2007


Author: cdavid
Date: 2007-10-18 08:35:27 -0500 (Thu, 18 Oct 2007)
New Revision: 4238

Added:
   branches/numpy.scons/numpy/random/SConstruct
Modified:
   branches/numpy.scons/numpy/random/setupscons.py
Log:
random module sconsified

Added: branches/numpy.scons/numpy/random/SConstruct
===================================================================
--- branches/numpy.scons/numpy/random/SConstruct	2007-10-18 12:58:14 UTC (rev 4237)
+++ branches/numpy.scons/numpy/random/SConstruct	2007-10-18 13:35:27 UTC (rev 4238)
@@ -0,0 +1,27 @@
+# Last Change: Thu Oct 18 10:00 PM 2007 J
+# vim:syntax=python
+import os
+
+from numpy.distutils.misc_util import get_numpy_include_dirs
+from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths
+
+env = GetNumpyEnvironment(ARGUMENTS)
+env.Append(CPPPATH = scons_get_paths(env['include_bootstrap']))
+
+mathlib = os.environ.get('MATHLIB')
+if mathlib: 
+    # XXX: prepend it ?
+    mlib = mathlib
+else:
+    mlib = 'm'
+env.Append(LIBS = mlib)
+
+import sys
+if sys.platform == 'win32':
+    assert 0 == 1, 'FIXME: support Advapi32 detection for win32 in mtrand'
+
+sources = [os.path.join('mtrand', x) for x in 
+           ['mtrand.c', 'randomkit.c', 'initarray.c', 'distributions.c']]
+
+# XXX: Pyrex dependency
+mtrand = env.NumpyPythonExtension('mtrand', source = sources)

Modified: branches/numpy.scons/numpy/random/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/random/setupscons.py	2007-10-18 12:58:14 UTC (rev 4237)
+++ branches/numpy.scons/numpy/random/setupscons.py	2007-10-18 13:35:27 UTC (rev 4238)
@@ -4,34 +4,7 @@
     from numpy.distutils.misc_util import Configuration, get_mathlibs
     config = Configuration('random',parent_package,top_path)
 
-    def generate_libraries(ext, build_dir):
-        config_cmd = config.get_config_cmd()
-        if top_path is None:
-            libs = get_mathlibs()
-        else:
-            #path = join(split(build_dir)[0],'core')
-            # XXX
-            path = join(config.get_scons_build_dir(), 'numpy','core')
-            libs = get_mathlibs(path)
-        tc = testcode_wincrypt()
-        if config_cmd.try_run(tc):
-            libs.append('Advapi32')
-        ext.libraries.extend(libs)
-        return None
-
-    libs = []
-    # Configure mtrand
-    config.add_extension('mtrand',
-                         sources=[join('mtrand', x) for x in
-                                  ['mtrand.c', 'randomkit.c', 'initarray.c',
-                                   'distributions.c']]+[generate_libraries],
-                         libraries=libs,
-                         depends = [join('mtrand','*.h'),
-                                    join('mtrand','*.pyx'),
-                                    join('mtrand','*.pxi'),
-                                    ]
-                        )
-
+    config.add_sconscript('SConstruct')
     config.add_data_files(('.', join('mtrand', 'randomkit.h')))
     config.add_data_dir('tests')
 




More information about the Numpy-svn mailing list