[pypy-svn] r18080 - pypy/dist/pypy/translator/tool

arigo at codespeak.net arigo at codespeak.net
Sun Oct 2 15:16:41 CEST 2005


Author: arigo
Date: Sun Oct  2 15:16:38 2005
New Revision: 18080

Modified:
   pypy/dist/pypy/translator/tool/cbuild.py
Log:
Log the invoked compiler commands.


Modified: pypy/dist/pypy/translator/tool/cbuild.py
==============================================================================
--- pypy/dist/pypy/translator/tool/cbuild.py	(original)
+++ pypy/dist/pypy/translator/tool/cbuild.py	Sun Oct  2 15:16:38 2005
@@ -1,10 +1,13 @@
 import autopath
 
-import py
-
 import os, sys, inspect, re, imp
 from pypy.translator.tool import stdoutcapture
 
+import py
+from pypy.tool.ansi_print import ansi_log
+log = py.log.Producer("cbuild")
+py.log.setconsumer("cbuild", ansi_log)
+
 debug = 0
 
 def make_module_from_pyxstring(name, dirpath, string):
@@ -245,6 +248,12 @@
     return getattr(mod, func.func_name)
 
 
+def log_spawned_cmd(spawn):
+    def spawn_and_log(cmd, *args, **kwds):
+        log.execute(' '.join(cmd))
+        return spawn(cmd, *args, **kwds)
+    return spawn_and_log
+
 def build_executable(cfilenames, outputfilename=None, include_dirs=None,
                      libraries=[]):
     from distutils.ccompiler import new_compiler 
@@ -259,7 +268,8 @@
     else: 
         outputfilename = py.path.local(outputfilename) 
 
-    compiler = new_compiler() 
+    compiler = new_compiler()
+    compiler.spawn = log_spawned_cmd(compiler.spawn)
     objects = []
     for cfile in cfilenames: 
         cfile = py.path.local(cfile)



More information about the Pypy-commit mailing list