[Numpy-svn] r4368 - in branches/numpy.scons/numpy: distutils distutils/scons/checkers distutils/scons/doc linalg

numpy-svn@scip... numpy-svn@scip...
Thu Nov 1 04:53:15 CDT 2007


Author: cdavid
Date: 2007-11-01 04:52:50 -0500 (Thu, 01 Nov 2007)
New Revision: 4368

Modified:
   branches/numpy.scons/numpy/distutils/misc_util.py
   branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py
   branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py
   branches/numpy.scons/numpy/distutils/scons/checkers/support.py
   branches/numpy.scons/numpy/distutils/scons/doc/TODO
   branches/numpy.scons/numpy/distutils/system_info.py
   branches/numpy.scons/numpy/linalg/SConstruct
   branches/numpy.scons/numpy/linalg/setupscons.py
Log:
basic show_config implementation

Modified: branches/numpy.scons/numpy/distutils/misc_util.py
===================================================================
--- branches/numpy.scons/numpy/distutils/misc_util.py	2007-10-31 23:21:39 UTC (rev 4367)
+++ branches/numpy.scons/numpy/distutils/misc_util.py	2007-11-01 09:52:50 UTC (rev 4368)
@@ -1517,7 +1517,7 @@
     f = open(target, 'w')
     f.write('# this file is generated by %s\n' % (os.path.abspath(sys.argv[0])))
     f.write('# it contains system_info results at the time of building this package.\n')
-    f.write('__all__ = ["get_info","show"]\n\n')
+    f.write('__all__ = ["show"]\n\n')
     confdir = get_scons_configres_dir()
     confilename = get_scons_configres_filename()
     for root, dirs, files in os.walk(confdir):
@@ -1532,27 +1532,19 @@
                 d[pkg_name] = config_mod.config
             finally:
                 fid.close()
-    for k, i in d.items():
-        f.write('%s=%r\n' % (k, i))
+    # d is a dictionary whose keys are package names, and values the
+    # corresponding configuration. Each configuration is itself a dictionary
+    # (lib : libinfo)
+    f.write('_config = %s\n' % d)
     f.write(r'''
-def get_info(name):
-    g = globals()
-    return g.get(name, g.get(name + "_info", {}))
-
 def show():
-    for name,info_dict in globals().items():
-        if name[0] == "_" or type(info_dict) is not type({}): continue
-        print name + ":"
-        if not info_dict:
-            print "  not available"
-        for k,v in info_dict.items():
-            v = str(v)
-            if k == "sources" and len(v) > 200:
-                v = v[:60] + " ...\n... " + v[-60:]
-            print "    %s = %s" % (k,v)
-        print
+    for pkg, config in _config.items():
+        print "package %s configuration:" % pkg
+        for lib, libc in config.items():
+            print '    %s' % lib
+            for line in libc.split('\n'):
+                print '\t%s' % line
     ''')
-
     f.close()
     return target
 

Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py	2007-10-31 23:21:39 UTC (rev 4367)
+++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py	2007-11-01 09:52:50 UTC (rev 4368)
@@ -114,7 +114,8 @@
                     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', opts)
+                if st:
+                    add_info(env, 'lapack', opts)
                 return st
 
             # Check ATLAS
@@ -128,8 +129,10 @@
                     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', opts)
-                # XXX: Check complete LAPACK or not
+                if st:
+                    add_info(env, 'lapack', opts)
+                # XXX: Check complete LAPACK or not. (Checking for not
+                # implemented lapack symbols ?)
                 return st
 
     return 0

Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py	2007-10-31 23:21:39 UTC (rev 4367)
+++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py	2007-11-01 09:52:50 UTC (rev 4368)
@@ -8,7 +8,9 @@
 # Generally, you don't use those directly: they are used in 'meta' checkers,
 # such as BLAS, CBLAS, LAPACK checkers.
 import re
+from os.path import join as pjoin
 
+from numpy.distutils.system_info import default_lib_dirs
 from numpy.distutils.scons.libinfo import get_config_from_section, get_config
 from numpy.distutils.scons.testcode_snippets import cblas_sgemm as cblas_src, \
         c_sgemm as sunperf_src, lapack_sgesv
@@ -51,7 +53,7 @@
     if not st:
         context.Result('Failed (could not check header(s) : check config.log '\
                        'in %s for more details)' % env['build_dir'])
-        return st, ConfigRes(opts, found)
+        return st, ConfigRes(name, opts, found)
 
     # Check whether the library is available (CheckLib-like checker)
     saved = save_and_set(env, opts)
@@ -68,7 +70,7 @@
     if not st:
         context.Result('Failed (could not check symbol %s : check config.log '\
                        'in %s for more details))' % (sym, env['build_dir']))
-        return st, ConfigRes(opts, found)
+        return st, ConfigRes(name, opts, found)
         
     context.Result(st)
 
@@ -82,9 +84,9 @@
                 version = 'Unknown (checking version failed)'
         else:
             version = 'Unkown (not implemented)'
-        cfgres = ConfigRes(opts, found, version)
+        cfgres = ConfigRes(name, opts, found, version)
     else:
-        cfgres = ConfigRes(opts, found, version = 'Not checked')
+        cfgres = ConfigRes(name, opts, found, version = 'Not checked')
 
     return st, cfgres
 
@@ -160,7 +162,9 @@
     """Check whether ATLAS is usable in C."""
     name    = 'ATLAS'
     section = 'atlas'
-    defopts = ConfigOpts(libs = ['atlas'])
+    defopts = ConfigOpts(libs = ['atlas'], 
+                         libpath = [pjoin(i, 'atlas') for i in 
+                                    default_lib_dirs])
     headers = ['atlas_enum.h']
     funcs   = ['ATL_sgemm']
     

Modified: branches/numpy.scons/numpy/distutils/scons/checkers/support.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/checkers/support.py	2007-10-31 23:21:39 UTC (rev 4367)
+++ branches/numpy.scons/numpy/distutils/scons/checkers/support.py	2007-11-01 09:52:50 UTC (rev 4368)
@@ -109,7 +109,8 @@
         return '\n'.join(msg)
 
 class ConfigRes():
-    def __init__(self, cfgopts, origin, version = None):
+    def __init__(self, name, cfgopts, origin, version = None):
+        self.name = name
         self.data = cfgopts.data
         self.origin = origin
         self.version = version
@@ -124,13 +125,14 @@
         return bool(self.origin)
 
     def __repr__(self):
+        msg = ['Using %s' % self.name]
         if self.is_customized():
-            msg = ['Customized items site.cfg:']
+            msg += [  'Customized items site.cfg:']
         else:
-            msg = ['Using default configuration:']
+            msg += ['  Using default configuration:']
 
-        msg += ['\t%s : %s' % (k, i) for k, i in self.data.items() if len(i) > 0]
-        msg += ['Version is : %s' % self.version]
+        msg += ['  %s : %s' % (k, i) for k, i in self.data.items() if len(i) > 0]
+        msg += ['  Version is : %s' % self.version]
         return '\n'.join(msg)
 
     def __str__(self):

Modified: branches/numpy.scons/numpy/distutils/scons/doc/TODO
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/doc/TODO	2007-10-31 23:21:39 UTC (rev 4367)
+++ branches/numpy.scons/numpy/distutils/scons/doc/TODO	2007-11-01 09:52:50 UTC (rev 4368)
@@ -1,8 +1,4 @@
 Before second alpha (in order of priority):
-    - show_config implementation : show libs, libpath and cpppath for each
-      configuration (~ 2-3 hours)
-    - BLAS, CBLAS and LAPACK meta checkers: overridable, support at least
-      ATLAS, Accelerate, and MKL (~ 2-3 hours)
     - Basic warn, debug and optim flags : at least gcc+linux, mingw, VS, gcc+mac
       os x, and posix ? (~ 2 hours).
 
@@ -12,9 +8,6 @@
 Design questions:
     - improve BrokenMathlib and Mathlib in core, and make them available to
       everyone
-    - How to build meta-checkers from simple checkers (for example, BLAS with
-      MKL, ATLAS, Sunperf, etc...) ?
-    - How to gather informations from checkers for config info ?
     - How to provide a usable framework for checks (+ doc)
     - overriding compilation flags: env variables, site.cfg ? (autotools
       convention ?)

Modified: branches/numpy.scons/numpy/distutils/system_info.py
===================================================================
--- branches/numpy.scons/numpy/distutils/system_info.py	2007-10-31 23:21:39 UTC (rev 4367)
+++ branches/numpy.scons/numpy/distutils/system_info.py	2007-11-01 09:52:50 UTC (rev 4368)
@@ -853,6 +853,7 @@
 
     def get_paths(self, section, key):
         pre_dirs = system_info.get_paths(self, section, key)
+        print "pre dirs is %s" % pre_dirs
         dirs = []
         for d in pre_dirs:
             dirs.extend(self.combine_paths(d,['atlas*','ATLAS*',

Modified: branches/numpy.scons/numpy/linalg/SConstruct
===================================================================
--- branches/numpy.scons/numpy/linalg/SConstruct	2007-10-31 23:21:39 UTC (rev 4367)
+++ branches/numpy.scons/numpy/linalg/SConstruct	2007-11-01 09:52:50 UTC (rev 4368)
@@ -3,6 +3,7 @@
 from numpy.distutils.misc_util import get_numpy_include_dirs, get_mathlibs
 from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths
 from numpy.distutils.scons import CheckLAPACK
+from numpy.distutils.scons.configuration import write_info
 
 env = GetNumpyEnvironment(ARGUMENTS)
 env.Append(CPPPATH = scons_get_paths(env['include_bootstrap']))
@@ -22,6 +23,7 @@
 env.AppendUnique(LIBS = mlib)
 
 config.Finish()
+write_info(env)
 
 sources = ['lapack_litemodule.c']
 if not use_lapack:

Modified: branches/numpy.scons/numpy/linalg/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/linalg/setupscons.py	2007-10-31 23:21:39 UTC (rev 4367)
+++ branches/numpy.scons/numpy/linalg/setupscons.py	2007-11-01 09:52:50 UTC (rev 4368)
@@ -10,7 +10,8 @@
                           source_files = ['lapack_litemodule.c',
                                           'zlapack_lite.c', 'dlapack_lite.c',
                                           'blas_lite.c', 'dlamch.c',
-                                          'f2c_lite.c','f2c.h'])
+                                          'f2c_lite.c','f2c.h'],
+                          post_hook = config.add_configres)
 
     return config
 



More information about the Numpy-svn mailing list