diff options
author | David Cournapeau <cournape@gmail.com> | 2008-01-07 02:43:05 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2008-01-07 02:43:05 +0000 |
commit | 38bd49de8052aa6347bc6b8f1d09e98e38e122a0 (patch) | |
tree | 849163132bca5a7350323ff621dddf2971050479 /numpy | |
parent | 022f76e7e3d66af6dbbd058f70095956407486b5 (diff) | |
download | numpy-38bd49de8052aa6347bc6b8f1d09e98e38e122a0.tar.gz |
numpy.random now builds with scons
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/random/SConstruct | 50 | ||||
-rw-r--r-- | numpy/random/setupscons.py | 40 |
2 files changed, 90 insertions, 0 deletions
diff --git a/numpy/random/SConstruct b/numpy/random/SConstruct new file mode 100644 index 000000000..95957ccd7 --- /dev/null +++ b/numpy/random/SConstruct @@ -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) diff --git a/numpy/random/setupscons.py b/numpy/random/setupscons.py new file mode 100644 index 000000000..969300ff6 --- /dev/null +++ b/numpy/random/setupscons.py @@ -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) |