[Numpy-svn] r4303 - in branches/numpy.scons/numpy/distutils/scons: . tools

numpy-svn@scip... numpy-svn@scip...
Fri Oct 26 02:18:25 CDT 2007


Author: cdavid
Date: 2007-10-26 02:18:10 -0500 (Fri, 26 Oct 2007)
New Revision: 4303

Modified:
   branches/numpy.scons/numpy/distutils/scons/__init__.py
   branches/numpy.scons/numpy/distutils/scons/custom_builders.py
   branches/numpy.scons/numpy/distutils/scons/fortran.py
   branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py
   branches/numpy.scons/numpy/distutils/scons/numpyenv.py
   branches/numpy.scons/numpy/distutils/scons/tools/substinfile.py
Log:
Do not make any SCons import in modules, to avoid clashes between internal scons and external scons

Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/__init__.py	2007-10-26 06:02:00 UTC (rev 4302)
+++ branches/numpy.scons/numpy/distutils/scons/__init__.py	2007-10-26 07:18:10 UTC (rev 4303)
@@ -5,3 +5,7 @@
         CheckAccelerate, CheckMKL, CheckSunperf
 from extension import get_python_inc, get_pythonlib_dir
 from utils import isstring
+
+def test(level=1, verbosity=1):
+    from numpy.testing import NumpyTest
+    return NumpyTest().test(level, verbosity)

Modified: branches/numpy.scons/numpy/distutils/scons/custom_builders.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/custom_builders.py	2007-10-26 06:02:00 UTC (rev 4302)
+++ branches/numpy.scons/numpy/distutils/scons/custom_builders.py	2007-10-26 07:18:10 UTC (rev 4303)
@@ -1,8 +1,5 @@
 from os.path import join as pjoin
 
-from SCons.Environment import Environment
-import SCons.Util
-
 def NumpySharedLibrary(env, target, source, *args, **kw):
     """This builder is the same than SharedLibrary, except for the fact that it
     takes into account build dir info passed by distutils, and put the target at
@@ -18,6 +15,7 @@
     """This builder is the same than PythonExtension, except for the fact that it
     takes into account build dir info passed by distutils, and put the target at
     the right location in distutils build directory for correct installation."""
+    import SCons.Util
     newsource = []
     for i in source:
         if SCons.Util.is_String(i):

Modified: branches/numpy.scons/numpy/distutils/scons/fortran.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/fortran.py	2007-10-26 06:02:00 UTC (rev 4302)
+++ branches/numpy.scons/numpy/distutils/scons/fortran.py	2007-10-26 07:18:10 UTC (rev 4303)
@@ -1,9 +1,10 @@
-#! Last Change: Tue Oct 23 08:00 PM 2007 J
+#! Last Change: Fri Oct 26 03:00 PM 2007 J
 
 # This module defines some functions/classes useful for testing fortran-related
 # features (name mangling, F77/C runtime, etc...).
 
 # KEEP THIS INDEPENDENT OF SCONS, PLEASE !!!
+# All this module is total crap, refactor it + needs testing
 
 import sys
 import re
@@ -11,7 +12,9 @@
 GCC_DRIVER_LINE = re.compile('^Driving:')
 POSIX_STATIC_EXT = re.compile('\S+\.a')
 POSIX_LIB_FLAGS = re.compile('-l\S+')
+MERGE_SPACE_R1 = re.compile('^-[LRuYz]$')
 
+
 def _check_link_verbose_posix(lines):
     """Returns true if useful link options can be found in output.
 
@@ -31,14 +34,12 @@
     else:
         return _check_link_verbose_posix(lines)
 
-merge_space_r1 = re.compile('^-[LRuYz]$')
-
 def merge_space(line):
     """matcher should be a callable, line a list of tokens."""
     nline = []
     for i in range(len(line)):
         ##print "hoho is %s" % line[i]
-        if merge_space_r1.match(line[i]):
+        if MERGE_SPACE_R1.match(line[i]):
             ##print '%s matched !' % line[i]
             merged = [line[i]]
             if not (line[i+1][0] == '-'):

Modified: branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py	2007-10-26 06:02:00 UTC (rev 4302)
+++ branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py	2007-10-26 07:18:10 UTC (rev 4303)
@@ -1,13 +1,11 @@
 #! /usr/bin/env python
-# Last Change: Thu Oct 25 01:00 PM 2007 J
+# Last Change: Fri Oct 26 04:00 PM 2007 J
 
 # Module for support to look for external code (replacement of
 # numpy.distutils.system_info). scons dependant code.
 import ConfigParser
 from copy import deepcopy
 
-from SCons.Util import is_List
-
 from libinfo import get_config, get_paths, parse_config_param
 from utils import get_empty
 
@@ -117,6 +115,8 @@
     # 
     # This needs testing, too.
     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+    from SCons.Util import is_List
+
     env = context.env
 
     # XXX: would be nice for each extension to add an option to

Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/numpyenv.py	2007-10-26 06:02:00 UTC (rev 4302)
+++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py	2007-10-26 07:18:10 UTC (rev 4303)
@@ -5,19 +5,15 @@
 
 from distutils.sysconfig import get_config_vars
 
-from SCons.Options import Options
-from SCons.Environment import Environment
-from SCons.Tool import Tool, FindTool, FindAllTools
-from SCons.Script import BuildDir, Help
-
 from numpy.distutils.command.scons import get_scons_build_dir
 
 from default import tool_list
 from custom_builders import NumpySharedLibrary, NumpyCtypes, NumpyPythonExtension
 from libinfo import get_config
 from extension_scons import PythonExtension
-from tools.substinfile import TOOL_SUBST
 
+from numpy.distutils.scons.tools.substinfile import TOOL_SUBST
+
 def pyplat2sconsplat():
     # XXX: should see how env['PLATFORM'] is defined, make this a dictionary 
     if sys.platform[:5] == 'linux':
@@ -50,6 +46,8 @@
 
 def GetNumpyOptions(args):
     """Call this with args=ARGUMENTS to take into account command line args."""
+    from SCons.Options import Options
+
     opts = Options(None, args)
     # Add directories related info
     opts.Add('pkg_name', 'name of the package (including parent package if any)', '')
@@ -71,6 +69,10 @@
 
 def GetNumpyEnvironment(args):
     """Call this with args = ARGUMENTS."""
+    from SCons.Environment import Environment
+    from SCons.Tool import Tool, FindTool, FindAllTools
+    from SCons.Script import BuildDir, Help
+
     # XXX: I would prefer subclassing Environment, because we really expect
     # some different behaviour than just Environment instances...
     opts = GetNumpyOptions(args)

Modified: branches/numpy.scons/numpy/distutils/scons/tools/substinfile.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/tools/substinfile.py	2007-10-26 06:02:00 UTC (rev 4302)
+++ branches/numpy.scons/numpy/distutils/scons/tools/substinfile.py	2007-10-26 07:18:10 UTC (rev 4303)
@@ -1,9 +1,6 @@
-# Last Change: Thu Oct 18 03:00 PM 2007 J
+# Last Change: Fri Oct 26 04:00 PM 2007 J
 
 import re
-import SCons.Action
-from SCons.Builder import Builder
-from SCons.Script import Depends
 
 def TOOL_SUBST(env):
     """Adds SubstInFile builder, which substitutes the keys->values of SUBST_DICT
@@ -15,6 +12,10 @@
     If there's more than one source and more than one target, each target gets
     substituted from the corresponding source.
     """
+    import SCons.Action
+    from SCons.Builder import Builder
+    from SCons.Script import Depends
+
     env.Append(TOOLS = 'SUBST')
     def do_subst_in_file(targetfile, sourcefile, dict):
         """Replace all instances of the keys of dict with their values.



More information about the Numpy-svn mailing list