[cfe-commits] r62396 - in /cfe/trunk/tools/ccc/ccclib: Driver.py Tools.py

Daniel Dunbar daniel at zuster.org
Fri Jan 16 18:02:35 PST 2009


Author: ddunbar
Date: Fri Jan 16 20:02:35 2009
New Revision: 62396

URL: http://llvm.org/viewvc/llvm-project?rev=62396&view=rev
Log:
ccc: Support running piped jobs (-pipe now works).

Modified:
    cfe/trunk/tools/ccc/ccclib/Driver.py
    cfe/trunk/tools/ccc/ccclib/Tools.py

Modified: cfe/trunk/tools/ccc/ccclib/Driver.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Driver.py?rev=62396&r1=62395&r2=62396&view=diff

==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Driver.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Driver.py Fri Jan 16 20:02:35 2009
@@ -197,7 +197,29 @@
                 if res:
                     sys.exit(res)
             elif isinstance(j, Jobs.PipedJob):
-                raise NotImplementedError,"Piped jobs aren't implemented yet."
+                import subprocess
+                procs = []
+                for sj in j.commands:
+                    if self.cccEcho:
+                        print ' '.join(map(repr,sj.getArgv()))
+                        sys.stdout.flush()
+
+                    if not procs:
+                        stdin = None
+                    else:
+                        stdin = procs[-1].stdout
+                    if sj is j.commands[-1]:
+                        stdout = None
+                    else:
+                        stdout = subprocess.PIPE
+                    procs.append(subprocess.Popen(sj.getArgv(), 
+                                                  executable=sj.executable,
+                                                  stdin=stdin,
+                                                  stdout=stdout))
+                for proc in procs:
+                    res = proc.wait()
+                    if res:
+                        sys.exit(res)
             else:
                 raise ValueError,'Encountered unknown job.'
 
@@ -585,7 +607,9 @@
         if hasPipe:
             self.claim(hasPipe)
             # FIXME: Hack, override -pipe till we support it.
-            hasPipe = None
+            if hasSaveTemps:
+                self.warning('-pipe ignored because -save-temps specified')
+                hasPipe = None
         # Claim these here. Its not completely accurate but any warnings
         # about these being unused are likely to be noise anyway.
         if hasSaveTemps:

Modified: cfe/trunk/tools/ccc/ccclib/Tools.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Tools.py?rev=62396&r1=62395&r2=62396&view=diff

==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Tools.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Tools.py Fri Jan 16 20:02:35 2009
@@ -141,7 +141,7 @@
 
         cmd_args.extend(arglist.render(output))
         if isinstance(input.source, Jobs.PipedJob):
-            cmd_args.append('-')
+            pass
         else:
             cmd_args.extend(arglist.renderAsInput(input.source))
             





More information about the cfe-commits mailing list