[Numpy-svn] r4560 - branches/numpy.scons/numpy/distutils/scons/core

numpy-svn at scipy.org numpy-svn at scipy.org
Fri Dec 7 04:21:01 EST 2007


Author: cdavid
Date: 2007-12-07 03:20:49 -0600 (Fri, 07 Dec 2007)
New Revision: 4560

Modified:
   branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py
   branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py
Log:

* Some basic cleaning of numpyenv
* Put the static-lib-for-extensions builder out of the numpyenv.py file



Modified: branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py	2007-12-07 09:16:41 UTC (rev 4559)
+++ branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py	2007-12-07 09:20:49 UTC (rev 4560)
@@ -1,5 +1,5 @@
 #! /usr/bin/env python
-# Last Change: Wed Dec 05 03:00 PM 2007 J
+# Last Change: Fri Dec 07 06:00 PM 2007 J
 
 # Module for support to build python extension. scons specific code goes here.
 import sys
@@ -104,3 +104,28 @@
                                   LIBPATH = LIBPATH, 
                                   CPPPATH = CPPPATH, *args, **kw)
     return wrap
+
+def createStaticExtLibraryBuilder(env):
+    """This is a utility function that creates the StaticExtLibrary Builder in
+    an Environment if it is not there already.
+
+    If it is already there, we return the existing one."""
+    import SCons.Action
+
+    try:
+        static_extlib = env['BUILDERS']['StaticExtLibrary']
+    except KeyError:
+        action_list = [ SCons.Action.Action("$ARCOM", "$ARCOMSTR") ]
+        if env.Detect('ranlib'):
+            ranlib_action = SCons.Action.Action("$RANLIBCOM", "$RANLIBCOMSTR")
+            action_list.append(ranlib_action)
+
+    static_extlib = SCons.Builder.Builder(action = action_list,
+                                          emitter = '$LIBEMITTER',
+                                          prefix = '$LIBPREFIX',
+                                          suffix = '$LIBSUFFIX',
+                                          src_suffix = '$OBJSUFFIX',
+                                          src_builder = 'SharedObject')
+
+    env['BUILDERS']['StaticExtLibrary'] = static_extlib
+    return static_extlib

Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py	2007-12-07 09:16:41 UTC (rev 4559)
+++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py	2007-12-07 09:20:49 UTC (rev 4560)
@@ -14,7 +14,8 @@
 from custom_builders import NumpySharedLibrary, NumpyCtypes, \
             NumpyPythonExtension, NumpyStaticExtLibrary
 from libinfo import get_config
-from extension_scons import PythonExtension, built_with_mstools
+from extension_scons import PythonExtension, built_with_mstools, \
+                            createStaticExtLibraryBuilder
 from utils import pkg_to_path
 
 import numpy.distutils.scons.tools
@@ -134,6 +135,9 @@
     env.AppendUnique(**cfg.get_flags_dict())
 
 def finalize_env(env):
+    """Call this at the really end of the numpy environment initialization."""
+    # This will customize some things, to cope with some idiosyncraties with
+    # some tools, and are too specific to be in tools.
     if built_with_mstools(env):
         major, minor = get_vs_version(env)
         # For VS 8 and above (VS 2005), use manifest for DLL
@@ -148,6 +152,9 @@
                         'mt.exe -nologo -manifest ${TARGET}.manifest '\
                         '-outputresource:$TARGET;2']
 
+    if is_f77_gnu(env['F77']):
+        env.AppendUnique(F77FLAGS = ['-fno-second-underscore'])
+
 def GetNumpyEnvironment(args):
     env = _GetNumpyEnvironment(args)
 
@@ -263,10 +270,6 @@
     if not env.has_key('SHF77FLAGS'):
         env['SHF77FLAGS'] = env.subst('$_SHFORTRANFLAGSG')
 
-    if is_f77_gnu(env['F77']):
-        # XXX: this has nothing to do here !
-        env.AppendUnique(F77FLAGS = ['-fno-second-underscore'])
-
 def initialize_cxx(env, path_list):
     from SCons.Tool import Tool, FindTool
 
@@ -482,28 +485,3 @@
                                          get_scons_configres_filename())
 
     return env
-
-def createStaticExtLibraryBuilder(env):
-    """This is a utility function that creates the StaticExtLibrary Builder in
-    an Environment if it is not there already.
-
-    If it is already there, we return the existing one."""
-    import SCons.Action
-
-    try:
-        static_extlib = env['BUILDERS']['StaticExtLibrary']
-    except KeyError:
-        action_list = [ SCons.Action.Action("$ARCOM", "$ARCOMSTR") ]
-        if env.Detect('ranlib'):
-            ranlib_action = SCons.Action.Action("$RANLIBCOM", "$RANLIBCOMSTR")
-            action_list.append(ranlib_action)
-
-    static_extlib = SCons.Builder.Builder(action = action_list,
-                                          emitter = '$LIBEMITTER',
-                                          prefix = '$LIBPREFIX',
-                                          suffix = '$LIBSUFFIX',
-                                          src_suffix = '$OBJSUFFIX',
-                                          src_builder = 'SharedObject')
-
-    env['BUILDERS']['StaticExtLibrary'] = static_extlib
-    return static_extlib




More information about the Numpy-svn mailing list