From f9fd76bca000a1956e7bff9ad7e7722fc248de67 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 3 Jul 2008 03:09:21 +0000 Subject: Use stdout.write() instead of "print", for py3k compat. svn path=/main/trunk/; revision=10897 --- pym/portage/output.py | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'pym') 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): -- cgit v1.2.3-1-g7c22