[Numpy-svn] r4325 - in branches/numpy.scons/numpy: core distutils/scons linalg
numpy-svn at scipy.org
numpy-svn at scipy.org
Mon Oct 29 05:57:57 EDT 2007
Author: cdavid
Date: 2007-10-29 04:57:43 -0500 (Mon, 29 Oct 2007)
New Revision: 4325
Added:
branches/numpy.scons/numpy/distutils/scons/configuration.py
Modified:
branches/numpy.scons/numpy/core/SConstruct
branches/numpy.scons/numpy/distutils/scons/custom_checkers.py
branches/numpy.scons/numpy/distutils/scons/numpyenv.py
branches/numpy.scons/numpy/linalg/SConstruct
Log:
Start working on a system to keep config info for packages
Modified: branches/numpy.scons/numpy/core/SConstruct
===================================================================
--- branches/numpy.scons/numpy/core/SConstruct 2007-10-29 09:09:59 UTC (rev 4324)
+++ branches/numpy.scons/numpy/core/SConstruct 2007-10-29 09:57:43 UTC (rev 4325)
@@ -1,4 +1,4 @@
-# Last Change: Mon Oct 29 03:00 PM 2007 J
+# Last Change: Mon Oct 29 06:00 PM 2007 J
# vim:syntax=python
import os
import sys
@@ -9,6 +9,7 @@
from numpy.distutils.scons import GetNumpyEnvironment
from numpy.distutils.scons import NumpyCheckLib
from numpy.distutils.scons.custom_checkers import CheckCBLAS, CheckMKL, CheckATLAS, CheckGenericBLAS, CheckGenericLAPACK
+from numpy.distutils.scons.configuration import write_info
from scons_support import CheckBrokenMathlib, define_no_smp, \
generate_config_header, generate_config_header_emitter, \
Added: branches/numpy.scons/numpy/distutils/scons/configuration.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/configuration.py 2007-10-29 09:09:59 UTC (rev 4324)
+++ branches/numpy.scons/numpy/distutils/scons/configuration.py 2007-10-29 09:57:43 UTC (rev 4325)
@@ -0,0 +1,34 @@
+#! /usr/bin/env python
+# Last Change: Mon Oct 29 06:00 PM 2007 J
+
+class opt_info:
+ def __init__(self, name, site = 0):
+ """If not available, set name to ''."""
+ self.name = name
+ if len(name) > 0:
+ self.available = 1
+ else:
+ self.available = 0
+ self.site = site
+
+ def __str__(self):
+ if self.available:
+ if self.site:
+ msg = ['Tweaked from site.cfg']
+ else:
+ msg = ['Use %s' % self.name]
+ else:
+ msg = ['None available']
+
+ return '\n'.join(msg)
+
+ def __repr__(self):
+ return self.__str__()
+
+def add_info(env, name, opt):
+ cfg = env['NUMPY_PKG_CONFIG']
+ cfg[name] = opt
+
+def write_info(env):
+ print "File is %s" % env['NUMPY_PKG_CONFIG_FILE']
+ print "Info is %s" % env['NUMPY_PKG_CONFIG']
Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-29 09:09:59 UTC (rev 4324)
+++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-29 09:57:43 UTC (rev 4325)
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-# Last Change: Mon Oct 29 03:00 PM 2007 J
+# Last Change: Mon Oct 29 06:00 PM 2007 J
# Module for custom, common checkers for numpy (and scipy)
import sys
@@ -14,6 +14,8 @@
from fortran_scons import CheckF77Mangling, CheckF77Clib
+from configuration import opt_info, add_info
+
def _check_include_and_run(context, name, cpppath, headers, run_src, libs,
libpath, linkflags, cflags, autoadd = 1):
"""This is a basic implementation for generic "test include and run"
@@ -171,6 +173,7 @@
[], linkflags, cflags, autoadd)
def CheckCBLAS(context, autoadd = 1):
+ env = context.env
# If section cblas is in site.cfg, use those options. Otherwise, use default
section = "cblas"
@@ -180,27 +183,43 @@
headers = ['cblas.h']
linkflags = []
cflags = []
- return _check_include_and_run(context, 'CBLAS', [], headers, cblas_src,
+ st = _check_include_and_run(context, 'CBLAS', [], headers, cblas_src,
libs, libpath, linkflags, cflags, autoadd)
+ if st:
+ add_info(env, 'cblas', opt_info('cblas', site = 1))
+ return st
else:
if sys.platform == 'darwin':
st = CheckAccelerate(context, autoadd)
if st:
+ add_info(env, 'cblas', opt_info('Accelerate'))
return st
st = CheckVeclib(context, autoadd)
- return st
+ if st:
+ add_info(env, 'cblas', opt_info('vecLib'))
+ return st
+
+ add_info(env, 'cblas', opt_info(''))
+ return 0
else:
# Check MKL, then ATLAS, then Sunperf
st = CheckMKL(context, autoadd)
if st:
+ add_info(env, 'cblas', opt_info('mkl'))
return st
st = CheckATLAS(context, autoadd)
if st:
+ add_info(env, 'cblas', opt_info('atlas'))
return st
st = CheckSunperf(context, autoadd)
- return st
+ if st:
+ add_info(env, 'cblas', opt_info('sunperf'))
+ return st
+ add_info(env, 'cblas', opt_info(''))
+ return 0
+
def CheckLAPACK(context, autoadd = 1):
# XXX: this whole thing is ugly. Think more about how to combine checkers
# in 'meta checker' like this.
@@ -234,6 +253,7 @@
fdict['LIBPATH'].extend(context.env['LIBPATH'])
st =_check_include_and_run(context, 'LAPACK (MKL)', [], [],
test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1)
+ add_info(env, 'lapack', opt_info('mkl'))
return st
# Check ATLAS
@@ -247,6 +267,7 @@
fdict['LIBPATH'].extend(context.env['LIBPATH'])
st =_check_include_and_run(context, 'LAPACK (ATLAS)', [], [],
test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1)
+ add_info(env, 'lapack', opt_info('atlas'))
# XXX: Check complete LAPACK or not
return st
Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-29 09:09:59 UTC (rev 4324)
+++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-29 09:57:43 UTC (rev 4325)
@@ -200,7 +200,6 @@
if env['CC'] == 'gcc':
env.Append(CCFLAGS = "-Wall -Wstrict-prototypes -fno-strict-aliasing -O3 -g")
- #print Environment().Dump()
# Adding custom builder
env['BUILDERS']['NumpySharedLibrary'] = NumpySharedLibrary
env['BUILDERS']['NumpyCtypes'] = NumpyCtypes
@@ -218,6 +217,10 @@
# Getting the config options from *.cfg files
config = get_config()
- env['NUMPYCONFIG'] = config
+ env['NUMPY_SITE_CONFIG'] = config
+ # This will be used to keep configuration information on a per package basis
+ env['NUMPY_PKG_CONFIG'] = {}
+ env['NUMPY_PKG_CONFIG_FILE'] = pjoin(env['build_dir'], '__configres.py')
+
return env
Modified: branches/numpy.scons/numpy/linalg/SConstruct
===================================================================
--- branches/numpy.scons/numpy/linalg/SConstruct 2007-10-29 09:09:59 UTC (rev 4324)
+++ branches/numpy.scons/numpy/linalg/SConstruct 2007-10-29 09:57:43 UTC (rev 4325)
@@ -1,4 +1,4 @@
-# Last Change: Mon Oct 29 03:00 PM 2007 J
+# Last Change: Mon Oct 29 06:00 PM 2007 J
# vim:syntax=python
from numpy.distutils.misc_util import get_numpy_include_dirs, get_mathlibs
from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths
More information about the Numpy-svn
mailing list