X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;ds=sidebyside;f=linkpair%2Futils%2Fcommon.py;h=9aad16c2436f525cdae2440ff63c915cc8be8199;hb=caf4642890aaf6be16fcfe79de0fe507acc82e1c;hp=5606fc16e148ff7d7f8e3b61ba35da0a76910c80;hpb=5da0ff1a33c6a971b9c6d315448f9edde08ddb82;p=ti2%2Fti2.git diff --git a/linkpair/utils/common.py b/linkpair/utils/common.py index 5606fc1..9aad16c 100755 --- a/linkpair/utils/common.py +++ b/linkpair/utils/common.py @@ -2,15 +2,17 @@ # -*- coding: utf-8 -*- # -__version__ = '1.1' - +from __future__ import print_function import re - +import sys class CommonUtils(object): def __init__(self): self._tmp_stack = [] + + def set_opts(self, opts): + self._opts = opts def d_push(self, x): self._tmp_stack.append(x) @@ -20,15 +22,21 @@ class CommonUtils(object): return self._tmp_stack.pop() def verbose_out(self, msg): - if self.opts.verbose is True: - print msg + if self._opts.verbose is True: + printr("[verbose]: " + msg, file=sys.stderr) def debug_out(self, msg): - if self.opts.debug is True: - print "debug: " + msg + if self._opts.debug is True: + print("[debug]: " + msg, file=sys.stderr) + + def warn_out(self, msg): + print("[warn]: " + msg, file=sys.stderr) + + def error_out(self, msg): + print("[error]: " + msg, file=sys.stderr) def message_out(self, msg): - print msg + print(msg) def parse_remote_desc(self, remote_desc): ssh_username = ""