[Numpy-svn] r4268 - in branches/numpy.scons/numpy: distutils/scons random

numpy-svn@scip... numpy-svn@scip...
Sun Oct 21 08:28:52 CDT 2007


Author: cdavid
Date: 2007-10-21 08:28:45 -0500 (Sun, 21 Oct 2007)
New Revision: 4268

Modified:
   branches/numpy.scons/numpy/distutils/scons/TODO
   branches/numpy.scons/numpy/random/SConstruct
Log:
Add Advapi32 support on windows for random module.

Modified: branches/numpy.scons/numpy/distutils/scons/TODO
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/TODO	2007-10-21 13:16:39 UTC (rev 4267)
+++ branches/numpy.scons/numpy/distutils/scons/TODO	2007-10-21 13:28:45 UTC (rev 4268)
@@ -19,6 +19,7 @@
       g77, gfortran (1st priority), MS and Intel (2d priority), others (3rd:
       sun, aix, etc...)
     - Refactor code for API generation (numpy/core/code_generators)
+    - Problems of per packages things (config.log, sconsign files, etc....)
 
 Documentation:
     - scons / distutils integration

Modified: branches/numpy.scons/numpy/random/SConstruct
===================================================================
--- branches/numpy.scons/numpy/random/SConstruct	2007-10-21 13:16:39 UTC (rev 4267)
+++ branches/numpy.scons/numpy/random/SConstruct	2007-10-21 13:28:45 UTC (rev 4268)
@@ -1,25 +1,40 @@
-# Last Change: Thu Oct 18 10:00 PM 2007 J
+# Last Change: Sun Oct 21 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
 
+def CheckWincrypt(context):
+    from copy import deepcopy
+    src = """\
+/* check to see if _WIN32 is defined */
+int main(int argc, char *argv[])
+{
+#ifdef _WIN32
+    return 0;
+#else
+    return 1;
+#endif
+}
+"""
+
+    context.Message("Checking if using wincrypt ... ")
+    st = context.env.TryRun(src, '.C')
+    if st[0] == 0:
+        context.Result('No')
+    else:
+        context.Result('Yes')
+    return st[0]
+    
 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)
+if os.name == 'nt':
+    config = env.NumpyConfigure(custom_tests = {'CheckWincrypt' : CheckWincrypt})
+    if config.CheckWincrypt:
+        config.env.AppendUnique(LIBS = 'Advapi32')
 
-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']]
 



More information about the Numpy-svn mailing list