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

numpy-svn@scip... numpy-svn@scip...
Wed Nov 21 04:29:58 CST 2007


Author: cdavid
Date: 2007-11-21 04:29:54 -0600 (Wed, 21 Nov 2007)
New Revision: 4482

Modified:
   branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py
Log:
Add a StaticExtLibrary builder, to build static libraries usable in python extensions (e.g. use SharedObject builders, but build .a)

Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py	2007-11-21 06:22:43 UTC (rev 4481)
+++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py	2007-11-21 10:29:54 UTC (rev 4482)
@@ -337,6 +337,8 @@
     env['BUILDERS']['NumpyFromCTemplate'] = NumpyFromCTemplate
     env['BUILDERS']['NumpyFromFTemplate'] = NumpyFromFTemplate
 
+    createStaticExtLibBuilder(env)
+
     # Setting build directory according to command line option
     if len(env['src_dir']) > 0:
         BuildDir(env['build_dir'], env['src_dir'])
@@ -356,3 +358,27 @@
                                          get_scons_configres_filename())
 
     return env
+
+def createStaticExtLibBuilder(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."""
+
+    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