[Numpy-svn] r4296 - in branches/numpy.scons/numpy: distutils/scons scons_fake

numpy-svn@scip... numpy-svn@scip...
Thu Oct 25 22:08:13 CDT 2007


Author: cdavid
Date: 2007-10-25 22:07:57 -0500 (Thu, 25 Oct 2007)
New Revision: 4296

Modified:
   branches/numpy.scons/numpy/distutils/scons/__init__.py
   branches/numpy.scons/numpy/distutils/scons/custom_checkers.py
   branches/numpy.scons/numpy/scons_fake/setup.py
   branches/numpy.scons/numpy/scons_fake/setupscons.py
Log:
Add autoadd option to custom checkers

Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/__init__.py	2007-10-26 02:39:59 UTC (rev 4295)
+++ branches/numpy.scons/numpy/distutils/scons/__init__.py	2007-10-26 03:07:57 UTC (rev 4296)
@@ -1,6 +1,7 @@
 from numpyenv import GetNumpyEnvironment, GetNumpyOptions
 from libinfo_scons import NumpyCheckLib
 from libinfo import get_paths as scons_get_paths
-#from custom_checkers import CheckTypeSize
+from custom_checkers import CheckMKL, CheckATLAS, CheckCBLAS, \
+        CheckAccelerate, CheckMKL2
 from extension import get_python_inc, get_pythonlib_dir
 from utils import isstring

Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py	2007-10-26 02:39:59 UTC (rev 4295)
+++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py	2007-10-26 03:07:57 UTC (rev 4296)
@@ -12,7 +12,7 @@
 from testcode_snippets import cblas_sgemm as cblas_src
 
 def _check_include_and_run(context, name, cpppath, headers, run_src, libs,
-                           libpath, linkflags, cflags):
+                           libpath, linkflags, cflags, autoadd = 1):
     """This is a basic implementation for generic "test include and run"
     testers.
     
@@ -73,11 +73,14 @@
                     [run_src, '#if 0', '%s' % libpath, 
                      '%s' % headers, '%s' % libs, '#endif'])
     ret = context.TryLink(src, '.c')
-    if not ret:
+    if (not ret or not autoadd):
+        # If test failed or autoadd = 0, restore everything
         env.Replace(LIBS = oldLIBS)
         env.Replace(LIBPATH = oldLIBPATH)
         env.Replace(RPATH = oldRPATH)
         env.Replace(LINKFLAGS = oldLINKFLAGS)
+
+    if not ret:
         context.Result('Failed: %s test could not be linked and run' % name)
         return 0
 
@@ -93,27 +96,36 @@
     libpath = os.path.join(mkl_dir, 'lib', nb)
 
     return _check_include_and_run(context, 'MKL', cpppath, ['mkl.h'],
-                                  cblas_src, libs, libpath, [], [])
+                                  cblas_src, libs, libpath, [], [], autoadd)
 
-def CheckATLAS(context, atl_dir):
-    """atl_dir is the root path of ATLAS (the one which contains libatlas)."""
+def CheckMKL2(context, autoadd = 1):
+    section = "mkl"
+    siteconfig, cfgfiles = get_config()
+    (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section)
+    headers = ['mkl.h']
 
+    return _check_include_and_run(context, 'MKL', cpppath, headers,
+                                  cblas_src, libs, libpath, [], [], autoadd)
+
+def CheckATLAS(context, autoadd = 1):
+    """Check whether ATLAS is usable in C."""
+
     libs = ['atlas', 'f77blas', 'cblas']
-    libpath = atl_dir
+    libpath = []
 
     return _check_include_and_run(context, 'ATLAS', None, ['atlas_enum.h', 'cblas.h'],
-                                  cblas_src, libs, libpath, [], [])
+                                  cblas_src, libs, libpath, [], [], autoadd)
 
-def CheckAccelerate(context):
+def CheckAccelerate(context, autoadd = 1):
     """Checker for Accelerate framework (on Mac OS X >= 10.3)."""
 
     linkflags = ['-framework', 'Accelerate']
 
     return _check_include_and_run(context, 'FRAMEWORK: Accelerate', None, 
                                   ['Accelerate/Accelerate.h'], cblas_src, [], 
-                                  [], linkflags, [])
+                                  [], linkflags, [], autoadd)
 
-def CheckCBLAS(context):
+def CheckCBLAS(context, autoadd = 1):
 
     # If section cblas is in site.cfg, use those options. Otherwise, use default
     section = "cblas"
@@ -156,4 +168,4 @@
             libs.append('cblas')
 
     return _check_include_and_run(context, 'CBLAS', [], headers, cblas_src,
-                                  libs, libpath, linkflags, cflags)
+                                  libs, libpath, linkflags, cflags, autoadd)

Modified: branches/numpy.scons/numpy/scons_fake/setup.py
===================================================================
--- branches/numpy.scons/numpy/scons_fake/setup.py	2007-10-26 02:39:59 UTC (rev 4295)
+++ branches/numpy.scons/numpy/scons_fake/setup.py	2007-10-26 03:07:57 UTC (rev 4296)
@@ -8,6 +8,7 @@
     config.add_subpackage('pyext')
     config.add_subpackage('ctypesext')
     config.add_subpackage('checklib')
+    config.add_subpackage('checkers')
     config.add_subpackage('hook')
     return config
 

Modified: branches/numpy.scons/numpy/scons_fake/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/scons_fake/setupscons.py	2007-10-26 02:39:59 UTC (rev 4295)
+++ branches/numpy.scons/numpy/scons_fake/setupscons.py	2007-10-26 03:07:57 UTC (rev 4296)
@@ -8,6 +8,7 @@
     config.add_subpackage('pyext')
     config.add_subpackage('ctypesext')
     config.add_subpackage('checklib')
+    config.add_subpackage('checkers')
     config.add_subpackage('hook')
     return config
 



More information about the Numpy-svn mailing list