[cfe-commits] r62207 - /cfe/trunk/tools/ccc/ccclib/Driver.py
Daniel Dunbar
daniel at zuster.org
Tue Jan 13 17:32:05 PST 2009
Author: ddunbar
Date: Tue Jan 13 19:32:05 2009
New Revision: 62207
URL: http://llvm.org/viewvc/llvm-project?rev=62207&view=rev
Log:
ccc: Add -ccc-echo special option, and support pulling CCC_CLANG,
CCC_ECHO, and CCC_FALLBACK from environment as ccc (old) did.
Modified:
cfe/trunk/tools/ccc/ccclib/Driver.py
Modified: cfe/trunk/tools/ccc/ccclib/Driver.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Driver.py?rev=62207&r1=62206&r2=62207&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Driver.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Driver.py Tue Jan 13 19:32:05 2009
@@ -33,6 +33,7 @@
self.cccHostSystem = self.cccHostRelease = None
self.cccCXX = False
self.cccClang = False
+ self.cccEcho = False
self.cccFallback = False
# Host queries which can be forcibly over-riden by the user for
@@ -69,6 +70,16 @@
return platform.release()
+ def getenvBool(self, name):
+ var = os.getenv(name)
+ if not var:
+ return False
+
+ try:
+ return bool(int(var))
+ except:
+ return False
+
###
def run(self, argv):
@@ -85,6 +96,13 @@
# FIXME: How to handle override of host? ccc specific options?
# Abuse -b?
+ if self.getenvBool('CCC_CLANG'):
+ self.cccClang = True
+ if self.getenvBool('CCC_ECHO'):
+ self.cccEcho = True
+ if self.getenvBool('CCC_FALLBACK'):
+ self.cccFallback = True
+
while argv and argv[0].startswith('-ccc-'):
opt,argv = argv[0][5:],argv[1:]
@@ -96,6 +114,8 @@
self.cccCXX = True
elif opt == 'clang':
self.cccClang = True
+ elif opt == 'echo':
+ self.cccEcho = True
elif opt == 'fallback':
self.cccFallback = True
elif opt == 'host-bits':
@@ -173,6 +193,9 @@
for j in jobs.iterjobs():
if isinstance(j, Jobs.Command):
+ if self.cccEcho:
+ print ' '.join(map(repr,j.getArgv()))
+ sys.stdout.flush()
res = os.spawnvp(os.P_WAIT, j.executable, j.getArgv())
if res:
sys.exit(res)
More information about the cfe-commits
mailing list