diff options
author | Seo Sanghyeon <sanxiyn@gmail.com> | 2008-02-03 03:40:41 +0000 |
---|---|---|
committer | Seo Sanghyeon <sanxiyn@gmail.com> | 2008-02-03 03:40:41 +0000 |
commit | 66de08bfb482198fb81bac27d19416c0dd694aa5 (patch) | |
tree | 913ff45ab6710df6490b36a98e92613a3ed9502a | |
parent | 7685891aa325639b918c73d1ccc0b2a0b498543e (diff) | |
download | bcm5719-llvm-66de08bfb482198fb81bac27d19416c0dd694aa5.tar.gz bcm5719-llvm-66de08bfb482198fb81bac27d19416c0dd694aa5.zip |
Make ccc work with older Python versions. Patch by Sam Bishop.
llvm-svn: 46675
-rwxr-xr-x | clang/utils/ccc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/clang/utils/ccc b/clang/utils/ccc index 015c0318d40..eff184392da 100755 --- a/clang/utils/ccc +++ b/clang/utils/ccc @@ -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": |