[Numpy-svn] r4401 - in branches/numpy.scons/numpy: distutils/scons distutils/scons/doc scons_fake/checkers

numpy-svn@scip... numpy-svn@scip...
Tue Nov 6 03:04:22 CST 2007


Author: cdavid
Date: 2007-11-06 03:04:10 -0600 (Tue, 06 Nov 2007)
New Revision: 4401

Modified:
   branches/numpy.scons/numpy/distutils/scons/Changelog
   branches/numpy.scons/numpy/distutils/scons/doc/DESIGN
   branches/numpy.scons/numpy/distutils/scons/doc/TODO
   branches/numpy.scons/numpy/distutils/scons/fortran_scons.py
   branches/numpy.scons/numpy/scons_fake/checkers/SConstruct
Log:
TODO and DESIGN documents updated, preliminary support for f2py in fortran checkers

Modified: branches/numpy.scons/numpy/distutils/scons/Changelog
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/Changelog	2007-11-06 07:58:46 UTC (rev 4400)
+++ branches/numpy.scons/numpy/distutils/scons/Changelog	2007-11-06 09:04:10 UTC (rev 4401)
@@ -1,3 +1,14 @@
+Tue, 06 Nov 2007 16:48:51 +0900
+User-visible Changes:
+	* LAPACK and CBLAS checkers are now overridable from site.cfg
+
+	* CheckF77Mangling and CheckF90Mangling define variables
+	NO_APPEND_FORTRAN, UPPERCASE_FORTRAN and UNDERSCORE_G77 (prepended by
+	F77_ or F90_ accordingly, e.g. F77_NO_APPEND_FORTRAN). PREPEND not
+	supported yet.
+
+	* Basic design explained in doc/DESIGN
+
 Mon, 05 Nov 2007 19:44:07 +0900 (2nd alpha)
 User-visible Changes:
 	* numpy/distutils/scons/checkers 

Modified: branches/numpy.scons/numpy/distutils/scons/doc/DESIGN
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/doc/DESIGN	2007-11-06 07:58:46 UTC (rev 4400)
+++ branches/numpy.scons/numpy/distutils/scons/doc/DESIGN	2007-11-06 09:04:10 UTC (rev 4401)
@@ -1,4 +1,4 @@
-.. Last Change: Tue Oct 30 12:00 PM 2007 J
+.. Last Change: Tue Nov 06 05:00 PM 2007 J
 .. vim:syntax=rest
 
 numpy.distutils.scons is basically an extension of numpy.distutils to use scons
@@ -70,3 +70,71 @@
 extensions are provided. I don't think static builders are necessary, since the
 code is unusable for any python extension, hence not really making sense for
 our usage.
+
+Global design
+=============
+
+For now, distutils.scons consists in mainly 5 parts: 
+    - the core part: numpyenv.py, default.py, utils.py, libinfo.py and
+      libinfo_scons.py
+    - custom builders: custom_builder.py, extension.py, extension_scons.py
+    - fortran support: fortran.py and fortran_scons.py.     
+    - custom checkers: checker submodule
+    - additional tools: tools submodule
+
+Only the core is really necessary for basic scons use (that is code which does
+not need BLAS/LAPACK or fortran support). Most of the other parts are necessary
+for advanced only projects, which mix fortran/C code, etc...
+
+Core
+----
+
+This makes interop with distutils possible. Some small parts are also parts of
+numpy.distutils. Parts which communicate directly with distutils are kept to a
+bare minimum, to avoid problems when setuptools will be better supported.  The
+core main function is GetNumpyEnvironment, which is what user will use in
+SConscripts to get environments.
+
+A function NumpyCheckLib is also provided, to check libraries ala autoconf
+(that is by trying to link a give library with a given list of symbols). The
+function is designed to behave exactly like CheckLib, except that is also
+supports being overridable by site.cfg and env var (ala system_info).
+
+custom builders
+---------------
+
+For now, only building C based and Ctypes-based is supported (SWIG and Pyrex
+will be next). Only the function whose names are prepended by Numpy should be
+used (those take care of build dir configuration and so on). Those are
+effectively scons builders.
+
+When you implement a new generic builder, please follow the separation: a part
+which has nothing to do with numpy, and a part based on the former to take care
+of build dir configuration. This enables upstream integration of some code.
+
+fortran support
+---------------
+
+This consists mainly in checkers usable from scons for mangling, link options
+for Fortran/C interop, etc...
+
+custom_checkers
+---------------
+
+This submodule defines some code for custom checkers. This is where performance
+libraries checks are implemented, as well as meta-checkers. The idea is that
+perflib defines functions to check for one performance library (say ATLAS,
+MKL), and that checkers in checkers/custom_checkers.py are 'meta' checkers
+based on perflib checkers. This makes meta-checkers easy to build on existing code.
+
+Most of the code for perflib checkers is generic enough so that writing a new
+one is easy (generally, a few lines of code). Those checkers can also
+optionally find version information if you implement the version_check
+function.
+
+Tools
+-----
+
+For now, it implements a gfortran tool (not yet supported by upstream scons),
+and a substinfile tool which is useful to generated a configuration file from a
+python dictionary (think config.h.in -> config.h).

Modified: branches/numpy.scons/numpy/distutils/scons/doc/TODO
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/doc/TODO	2007-11-06 07:58:46 UTC (rev 4400)
+++ branches/numpy.scons/numpy/distutils/scons/doc/TODO	2007-11-06 09:04:10 UTC (rev 4401)
@@ -1,13 +1,9 @@
 Before second alpha (in order of priority):
     - CheckHeader and CheckLib ala scons, with site.cfg support.
-    - Finish refactorization of perflib and custom checkers: check with
-      test_snippets in meta checkers, make meta-checkers overridable through
-      site.cfg
-    - f2py: supports the macro in doc/FORTRAN
     - support environments wo fortran compilers
 
 Before first beta:
-    - f2py and scipy interoperability: N hours
+    - f2py and scipy interoperability: N hours ?
 
 Design questions:
     - improve BrokenMathlib and Mathlib in core, and make them available to

Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py	2007-11-06 07:58:46 UTC (rev 4400)
+++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py	2007-11-06 09:04:10 UTC (rev 4401)
@@ -1,4 +1,4 @@
-# Last Change: Fri Nov 02 05:00 PM 2007 J
+# Last Change: Tue Nov 06 05:00 PM 2007 J
 import os
 import sys
 import string
@@ -159,6 +159,8 @@
 
 # Fortran name mangling
 def _CheckFMangling(context, fc, dummym, ext):
+    # XXX: rewrite this in a more straightfoward manner, and support prepending
+    # underscore
     subr = """
       subroutine foobar()
       return
@@ -220,6 +222,23 @@
         env.Replace(LIBS = savedLIBS)
     return result, mangler, u, du, c
 
+def _set_mangling_var(context, u, du, case, type = 'F77'):
+    env = context.env
+    if du == '_':
+         env['%s_UNDERSCORE_G77' % type] = 1
+    else:
+         env['%s_UNDERSCORE_G77' % type] = 0
+
+    if u == '_':
+         env['%s_NO_APPEND_FORTRAN' % type] = 0
+    else:
+         env['%s_NO_APPEND_FORTRAN' % type] = 1
+
+    if case == 'upper':
+        env['%s_UPERCASE_FORTRAN' % type] = 1
+    else:
+        env['%s_UPERCASE_FORTRAN' % type] = 0
+
 def CheckF77Mangling(context):
     """Find mangling of the F77 compiler.
     
@@ -235,6 +254,7 @@
     if res:
         context.Result("'%s', '%s', %s-case." % (u, du, c))
         env['F77_NAME_MANGLER'] = mangler
+        _set_mangling_var(context, u, du, c, 'F77')
     else:
         context.Result("all variants failed.")
     return res
@@ -246,6 +266,7 @@
     if res:
         context.Result("'%s', '%s', %s-case." % (u, du, c))
         env['F90_NAME_MANGLER'] = mangler
+        _set_mangling_var(context, u, du, c, 'F90')
     else:
         context.Result("all variants failed.")
     return res

Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct
===================================================================
--- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct	2007-11-06 07:58:46 UTC (rev 4400)
+++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct	2007-11-06 09:04:10 UTC (rev 4401)
@@ -3,6 +3,7 @@
 from numpy.distutils.scons.checkers.perflib import \
         CheckATLAS, CheckAccelerate, CheckMKL, CheckSunperf
 from numpy.distutils.scons.checkers.custom_checkers import CheckCBLAS, CheckLAPACK
+from numpy.distutils.scons import CheckF77Mangling
 
 env = GetNumpyEnvironment(ARGUMENTS)
 
@@ -19,6 +20,7 @@
     'CheckAccelerate' : CheckAccelerate,
     'CheckCBLAS' : CheckCBLAS,
     'CheckLAPACK' : CheckLAPACK,
+    'CheckF77Mangling' : CheckF77Mangling,
     'CheckSunperf' : CheckSunperf})
 
 do_check = 1
@@ -29,6 +31,7 @@
     st, opts = config.CheckSunperf(autoadd = 0)
     st = config.CheckCBLAS(autoadd = 0)
     st = config.CheckLAPACK(autoadd = 0)
+    st = config.CheckF77Mangling()
 
     if env.has_key('LIBS'):
         print "LIBS of env is %s" % env.Dump('LIBS')



More information about the Numpy-svn mailing list