diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-07-03 03:09:21 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-07-03 03:09:21 +0000 |
commit | f9fd76bca000a1956e7bff9ad7e7722fc248de67 (patch) | |
tree | 5eafc69c56e52392686a2ef528c191c0cfeb506f | |
parent | 3f7369f9f1234c4765c72917a2258cc0ee369a74 (diff) | |
download | portage-f9fd76bca000a1956e7bff9ad7e7722fc248de67.tar.gz portage-f9fd76bca000a1956e7bff9ad7e7722fc248de67.tar.bz2 portage-f9fd76bca000a1956e7bff9ad7e7722fc248de67.zip |
Use stdout.write() instead of "print", for py3k compat.
svn path=/main/trunk/; revision=10897
-rw-r--r-- | pym/portage/output.py | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/pym/portage/output.py b/pym/portage/output.py index 45def2b38..35dba7f0d 100644 --- a/pym/portage/output.py +++ b/pym/portage/output.py @@ -461,8 +461,10 @@ class EOutput(object): self.ewarn(msg[0]) if self.__last_e_cmd != "ebegin": self.__last_e_len = 0 - print "%*s%s" % ((self.term_columns - self.__last_e_len - 6), "", status_brackets) - sys.stdout.flush() + out = sys.stdout + out.write("%*s%s\n" % \ + ((self.term_columns - self.__last_e_len - 6), "", status_brackets)) + out.flush() def ebegin(self, msg): """ @@ -501,10 +503,12 @@ class EOutput(object): @param msg: A very brief (shorter than one line) error message. @type msg: StringType """ + out = sys.stdout if not self.quiet: - if self.__last_e_cmd == "ebegin": print - print colorize("BAD", " * ") + msg - sys.stdout.flush() + if self.__last_e_cmd == "ebegin": + out.write("\n") + out.write(colorize("BAD", " * ") + msg + "\n") + out.flush() self.__last_e_cmd = "eerror" def einfo(self, msg): @@ -514,10 +518,12 @@ class EOutput(object): @param msg: A very brief (shorter than one line) informative message. @type msg: StringType """ + out = sys.stdout if not self.quiet: - if self.__last_e_cmd == "ebegin": print - print colorize("GOOD", " * ") + msg - sys.stdout.flush() + if self.__last_e_cmd == "ebegin": + out.write("\n") + out.write(colorize("GOOD", " * ") + msg + "\n") + out.flush() self.__last_e_cmd = "einfo" def einfon(self, msg): @@ -527,10 +533,12 @@ class EOutput(object): @param msg: A very brief (shorter than one line) informative message. @type msg: StringType """ + out = sys.stdout if not self.quiet: - if self.__last_e_cmd == "ebegin": print - print colorize("GOOD", " * ") + msg , - sys.stdout.flush() + if self.__last_e_cmd == "ebegin": + out.write("\n") + out.write(colorize("GOOD", " * ") + msg) + out.flush() self.__last_e_cmd = "einfon" def ewarn(self, msg): @@ -540,10 +548,12 @@ class EOutput(object): @param msg: A very brief (shorter than one line) warning message. @type msg: StringType """ + out = sys.stdout if not self.quiet: - if self.__last_e_cmd == "ebegin": print - print colorize("WARN", " * ") + msg - sys.stdout.flush() + if self.__last_e_cmd == "ebegin": + out.write("\n") + out.write(colorize("WARN", " * ") + msg + "\n") + out.flush() self.__last_e_cmd = "ewarn" def ewend(self, errno, *msg): |