diff options
author | Stanislav Ochotnicky <sochotnicky@gmail.com> | 2009-06-03 11:23:33 +0200 |
---|---|---|
committer | Stanislav Ochotnicky <sochotnicky@gmail.com> | 2009-06-03 11:23:33 +0200 |
commit | d525ceabc3e1039c698dfaefcc9b892ecbfae886 (patch) | |
tree | c3e9589c6361bd34f92063ebdb7ccd37b1c6c176 /util | |
parent | cleanup (diff) | |
download | collagen-d525ceabc3e1039c698dfaefcc9b892ecbfae886.tar.gz collagen-d525ceabc3e1039c698dfaefcc9b892ecbfae886.tar.bz2 collagen-d525ceabc3e1039c698dfaefcc9b892ecbfae886.zip |
Moved WritableObject to common util library
Diffstat (limited to 'util')
-rw-r--r-- | util/__init__.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/util/__init__.py b/util/__init__.py new file mode 100644 index 0000000..c0d7b5a --- /dev/null +++ b/util/__init__.py @@ -0,0 +1,21 @@ + + +class WritableObject: + """Class for buffering output + + used in various places for catching stdout/stderr of emerge + library functions + """ + def __init__(self): + self.content = [] + def write(self, string): + self.content.append(string) + def isatty(self): + return 0 + def flush(self): + pass + def getvalue(self): + ret = "" + for part in self.content: + ret = ret + part + return ret |