From: Zac Medico Date: Thu, 3 Jul 2008 03:09:21 +0000 (-0000) Subject: Use stdout.write() instead of "print", for py3k compat. X-Git-Tag: v2.2_rc2~239 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f9fd76bca000a1956e7bff9ad7e7722fc248de67;p=portage.git Use stdout.write() instead of "print", for py3k compat. svn path=/main/trunk/; revision=10897 --- 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):