[Numpy-svn] r4234 - in branches/numpy.scons/numpy/distutils: command scons

numpy-svn@scip... numpy-svn@scip...
Thu Oct 18 07:34:54 CDT 2007


Author: cdavid
Date: 2007-10-18 07:34:47 -0500 (Thu, 18 Oct 2007)
New Revision: 4234

Modified:
   branches/numpy.scons/numpy/distutils/command/scons.py
   branches/numpy.scons/numpy/distutils/scons/__init__.py
   branches/numpy.scons/numpy/distutils/scons/numpyenv.py
Log:
Add option to scons command to bootstrap numpy

Modified: branches/numpy.scons/numpy/distutils/command/scons.py
===================================================================
--- branches/numpy.scons/numpy/distutils/command/scons.py	2007-10-18 09:43:48 UTC (rev 4233)
+++ branches/numpy.scons/numpy/distutils/command/scons.py	2007-10-18 12:34:47 UTC (rev 4234)
@@ -7,6 +7,7 @@
 from numpy.distutils.command.build_ext import build_ext as old_build_ext
 from numpy.distutils.ccompiler import CCompiler
 from numpy.distutils.exec_command import find_executable
+from numpy.distutils import log
 
 def get_scons_build_dir():
     """Return the top path where everything produced by scons will be put.
@@ -30,6 +31,13 @@
     import sys
     return sys.executable
 
+def dirl_to_str(dirlist):
+    """Given a list of directories, returns a string where the paths are
+    concatenated by the path separator.
+
+    example: ['foo/bar', 'bar/foo'] will return 'foo/bar:bar/foo'."""
+    return os.pathsep.join(dirlist)
+
 def dist2sconscc(compiler):
     """This converts the name passed to distutils to scons name convention (C
     compiler). The argument should be a CCompiler instance.
@@ -132,6 +140,7 @@
         scons_exec += ' ' + protect_path(pjoin(get_scons_local_path(), 'scons.py'))
         for sconscript, pre_hook, post_hook in self.scons_scripts:
             # XXX: This is inefficient... (use join instead)
+            from numpy.distutils.misc_util import get_numpy_include_dirs
             cmd = scons_exec + " -f " + sconscript + ' -I. '
             if self.jobs:
                 cmd += " --jobs=%d " % int(self.jobs)
@@ -140,6 +149,8 @@
                                                                 pdirname(sconscript)))
             cmd += ' cc_opt=%s ' % dist2sconscc(self.compiler)
             cmd += ' cc_opt_path=%s ' % protect_path(get_tool_path(self.compiler))
+            cmd += ' include_bootstrap=%s ' % dirl_to_str(get_numpy_include_dirs())
+            log.info("Executing scons command: %s ", cmd)
             st = os.system(cmd)
             if st:
                 print "status is %d" % st

Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/__init__.py	2007-10-18 09:43:48 UTC (rev 4233)
+++ branches/numpy.scons/numpy/distutils/scons/__init__.py	2007-10-18 12:34:47 UTC (rev 4234)
@@ -1,4 +1,5 @@
 from numpyenv import GetNumpyEnvironment, GetNumpyOptions
 from libinfo_scons import NumpyCheckLib
+from libinfo import get_paths as scons_get_paths
 from custom_checkers import CheckTypeSize
 from extension import get_python_inc

Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/numpyenv.py	2007-10-18 09:43:48 UTC (rev 4233)
+++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py	2007-10-18 12:34:47 UTC (rev 4234)
@@ -59,6 +59,10 @@
     opts.Add('distutils_libdir', 
              'build dir for libraries of distutils (NOT including the package name)', 
              pjoin('build', 'lib'))
+    opts.Add('include_bootstrap', 
+             "include directories for boostraping numpy (if you do not know" \
+             " what that means, you don't need it)" ,
+             '')
 
     # Add compiler related info
     opts.Add('cc_opt', 'name of C compiler', '')



More information about the Numpy-svn mailing list