llvm-6502/utils/llvm-build/llvmbuild/util.py
Daniel Dunbar 9da6b12441 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
2011-11-03 17:56:10 +00:00

21 lines
713 B
Python

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']