diff options
author | Ned Ludd <solar@gentoo.org> | 2006-01-01 19:12:09 +0000 |
---|---|---|
committer | Ned Ludd <solar@gentoo.org> | 2006-01-01 19:12:09 +0000 |
commit | 9ea9ba1a895fb9cc4c7d3c0710b676b1693227ea (patch) | |
tree | e36cd3622b81a4ea86536694714aa091efe09278 | |
parent | 65d3b349a2d87491731cf3e6fff54efbf9e7287e (diff) | |
download | portage-9ea9ba1a895fb9cc4c7d3c0710b676b1693227ea.tar.gz portage-9ea9ba1a895fb9cc4c7d3c0710b676b1693227ea.tar.bz2 portage-9ea9ba1a895fb9cc4c7d3c0710b676b1693227ea.zip |
- added writemsg_stdout function and make portage use it internally
svn path=/main/trunk/; revision=2516
-rw-r--r-- | pym/portage_util.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pym/portage_util.py b/pym/portage_util.py index b5bfda9b7..ef155b5db 100644 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -8,12 +8,19 @@ if not hasattr(__builtins__, "set"): from sets import Set as set noiselimit = 0 -def writemsg(mystr,noiselevel=0): + +def writemsg(mystr,noiselevel=0,fd=None): """Prints out warning and debug messages based on the noiselimit setting""" global noiselimit + if fd is None: + fd = sys.stderr if noiselevel <= noiselimit: - sys.stderr.write(mystr) - sys.stderr.flush() + fd.write(mystr) + fd.flush() + +def writemsg_stdout(mystr,noiselevel=0): + """Prints messages stdout based on the noiselimit setting""" + writemsg(mystr, noiselevel=noiselevel, fd=sys.stdout) def grabfile(myfilename, compat_level=0, recursive=0): """This function grabs the lines in a file, normalizes whitespace and returns lines in a list; if a line |