[Numpy-svn] r4698 - branches/build_with_scons/numpy/random
numpy-svn at scipy.org
numpy-svn at scipy.org
Sun Jan 6 21:43:12 EST 2008
Author: cdavid
Date: 2008-01-06 20:43:05 -0600 (Sun, 06 Jan 2008)
New Revision: 4698
Added:
branches/build_with_scons/numpy/random/SConstruct
branches/build_with_scons/numpy/random/setupscons.py
Log:
numpy.random now builds with scons
Added: branches/build_with_scons/numpy/random/SConstruct
===================================================================
--- branches/build_with_scons/numpy/random/SConstruct 2008-01-07 02:42:16 UTC (rev 4697)
+++ branches/build_with_scons/numpy/random/SConstruct 2008-01-07 02:43:05 UTC (rev 4698)
@@ -0,0 +1,50 @@
+# Last Change: Tue Nov 13 11:00 PM 2007 J
+# vim:syntax=python
+import os
+
+import __builtin__
+__builtin__.__NUMPY_SETUP__ = True
+
+from numpy.distutils.misc_util import get_numpy_include_dirs, get_mathlibs
+from numscons import GetNumpyEnvironment, scons_get_paths, \
+ scons_get_mathlib
+
+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']))
+
+mlib = scons_get_mathlib(env)
+env.AppendUnique(LIBS = mlib)
+
+# On windows, see if we should use Advapi32
+if os.name == 'nt':
+ config = env.NumpyConfigure(custom_tests = {'CheckWincrypt' : CheckWincrypt})
+ if config.CheckWincrypt:
+ config.env.AppendUnique(LIBS = 'Advapi32')
+
+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)
Added: branches/build_with_scons/numpy/random/setupscons.py
===================================================================
--- branches/build_with_scons/numpy/random/setupscons.py 2008-01-07 02:42:16 UTC (rev 4697)
+++ branches/build_with_scons/numpy/random/setupscons.py 2008-01-07 02:43:05 UTC (rev 4698)
@@ -0,0 +1,40 @@
+import glob
+from os.path import join, split
+
+def configuration(parent_package='',top_path=None):
+ from numpy.distutils.misc_util import Configuration, get_mathlibs
+ config = Configuration('random',parent_package,top_path)
+
+ source_files = [join('mtrand', i) for i in ['mtrand.c',
+ 'mtrand.pyx',
+ 'numpy.pxi',
+ 'randomkit.c',
+ 'randomkit.h',
+ 'Python.pxi',
+ 'initarray.c',
+ 'initarray.h',
+ 'distributions.c',
+ 'distributions.h',
+ ]]
+ config.add_sconscript('SConstruct', source_files = source_files)
+ config.add_data_files(('.', join('mtrand', 'randomkit.h')))
+ config.add_data_dir('tests')
+
+ return config
+
+def testcode_wincrypt():
+ return """\
+/* check to see if _WIN32 is defined */
+int main(int argc, char *argv[])
+{
+#ifdef _WIN32
+ return 0;
+#else
+ return 1;
+#endif
+}
+"""
+
+if __name__ == '__main__':
+ from numpy.distutils.core import setup
+ setup(configuration=configuration)
More information about the Numpy-svn
mailing list