diff options
author | Daniel Dunbar <daniel@zuster.org> | 2011-11-03 17:56:10 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2011-11-03 17:56:10 +0000 |
commit | 9da6b1244191319b39779307d60d7729811d3d5c (patch) | |
tree | 98c986953a77250405c407c4efd4062c794d8446 /utils/llvm-build/llvmbuild/util.py | |
parent | df578254a1241a6cab122aa6d5396995d928e24a (diff) |
llvm-build: Fill in more of component parsing to be more strict and
differentiate between strings and lists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143622 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/llvm-build/llvmbuild/util.py')
-rw-r--r-- | utils/llvm-build/llvmbuild/util.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/utils/llvm-build/llvmbuild/util.py b/utils/llvm-build/llvmbuild/util.py new file mode 100644 index 0000000000..cf6fa28573 --- /dev/null +++ b/utils/llvm-build/llvmbuild/util.py @@ -0,0 +1,20 @@ +import inspect +import os +import sys + +def _write_message(kind, message): + # Get the file/line where this message was generated. + f = inspect.currentframe() + # Step out of _write_message, and then out of wrapper. + f = f.f_back.f_back + file,line,_,_,_ = inspect.getframeinfo(f) + location = '%s:%d' % (os.path.basename(file), line) + + print >>sys.stderr, '%s: %s: %s' % (location, kind, message) + +note = lambda message: _write_message('note', message) +warning = lambda message: _write_message('warning', message) +error = lambda message: _write_message('error', message) +fatal = lambda message: (_write_message('fatal error', message), sys.exit(1)) + +__all__ = ['note', 'warning', 'error', 'fatal'] |