7 from __future__
import absolute_import, division, print_function
32 warnings.warn(message, stacklevel=2)
34 print(message, file=sys.stderr)
38 raise RuntimeError(message)
41 print(message, file=sys.stderr)
55 msg =
"Error running %s" % cmd.split()[0]
57 msg =
"Error running external command"
58 process = subprocess.Popen(cmd, shell=
True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
59 stdout, stderr = process.communicate()
60 if process.returncode != 0:
62 raise RuntimeError(
"%s: %s" % (msg, stderr))
65 state.log.warn(
"%s: %s" % (msg, stderr))
86 if isinstance(cls, type):
92 if kw[
"name"]
is None: kw[
"name"] = member.__name__
94 setattr(scope, kw[
"name"], member)
def memberOf
A Python decorator that injects functions into a class.
A dead-simple logger for all messages.
def runExternal
Safe wrapper for running external programs, reading stdout, and sanitizing error messages.