[cfe-commits] r46675 - /cfe/trunk/utils/ccc

Seo Sanghyeon sanxiyn at gmail.com
Sat Feb 2 19:40:41 PST 2008


Author: sanxiyn
Date: Sat Feb  2 21:40:41 2008
New Revision: 46675

URL: http://llvm.org/viewvc/llvm-project?rev=46675&view=rev
Log:
Make ccc work with older Python versions. Patch by Sam Bishop.

Modified:
    cfe/trunk/utils/ccc

Modified: cfe/trunk/utils/ccc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ccc?rev=46675&r1=46674&r2=46675&view=diff

==============================================================================
--- cfe/trunk/utils/ccc (original)
+++ cfe/trunk/utils/ccc Sat Feb  2 21:40:41 2008
@@ -11,37 +11,37 @@
 #
 ##===----------------------------------------------------------------------===##
 
+import os
 import sys
-import subprocess
 
 def error(message):
     print >> sys.stderr, 'ccc: ' + message
     sys.exit(1)
 
 def run(args):
-    print >> sys.stderr, ' '.join(args)
-    code = subprocess.call(args)
+    cmd = ' '.join(args)
+    print >> sys.stderr, cmd
+    code = os.system(cmd)
     if code:
         sys.exit(code)
 
 def preprocess(args):
-    command = 'clang -E'.split()
-    run(command + args)
+    run(['clang -E'] + args)
 
 def compile(args):
-    command = 'clang -emit-llvm-bc'.split()
-    run(command + args)
+    run(['clang -emit-llvm-bc'] + args)
 
 def link(args):
-    command = 'llvm-ld -native'.split()
-    run(command + args)
+    run(['llvm-ld -native'] + args)
 
 def extension(path):
-    return path.rpartition(".")[2]
+    return path.split(".")[-1]
 
 def changeextension(path, newext):
-    components = path.rpartition(".")
-    return "".join([components[0], components[1], newext])
+    i = path.rfind('.')
+    if i < 0:
+        return path
+    return path[:i] + newext
 
 def inferlanguage(extension):
     if extension == "c":





More information about the cfe-commits mailing list