From e351a8cbd4d40999642c93af9762253cb9753c4c Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 12 Jul 2011 10:32:09 -0700 Subject: [PATCH] Remove unneeded _unicode_decode for io.StringIO. Since StringIO.StringIO fallback was removed in commit 5df96179611ce0e98727945b1800b43daccedfc2, we can rely on io.StringIO.getoutput() to return unicode, so there's no need to call _unicode_decode on the result. --- pym/_emerge/AbstractEbuildProcess.py | 5 +---- pym/_emerge/BinpkgVerifier.py | 5 +---- pym/_emerge/EbuildFetcher.py | 3 +-- pym/_emerge/EbuildPhase.py | 13 ++++--------- pym/portage/package/ebuild/_ipc/QueryCommand.py | 4 +--- 5 files changed, 8 insertions(+), 22 deletions(-) diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py index 49b85eba3..4147ecb7b 100644 --- a/pym/_emerge/AbstractEbuildProcess.py +++ b/pym/_emerge/AbstractEbuildProcess.py @@ -13,8 +13,6 @@ from portage.localization import _ from portage.package.ebuild._ipc.ExitCommand import ExitCommand from portage.package.ebuild._ipc.QueryCommand import QueryCommand from portage import os -from portage import _encodings -from portage import _unicode_decode from portage.util._pty import _create_pty_or_pipe from portage.util import apply_secpass_permissions @@ -226,8 +224,7 @@ class AbstractEbuildProcess(SpawnProcess): elog_func(line, phase=phase, key=self.settings.mycpv, out=out) finally: portage.output.havecolor = global_havecolor - msg = _unicode_decode(out.getvalue(), - encoding=_encodings['content'], errors='replace') + msg = out.getvalue() if msg: log_path = None if self.settings.get("PORTAGE_BACKGROUND") != "subprocess": diff --git a/pym/_emerge/BinpkgVerifier.py b/pym/_emerge/BinpkgVerifier.py index 91dc8a7d3..0052967f6 100644 --- a/pym/_emerge/BinpkgVerifier.py +++ b/pym/_emerge/BinpkgVerifier.py @@ -7,8 +7,6 @@ import io import sys import portage from portage import os -from portage import _encodings -from portage import _unicode_decode from portage.package.ebuild.fetch import _checksum_failure_temp_file class BinpkgVerifier(AsynchronousTask): @@ -67,8 +65,7 @@ class BinpkgVerifier(AsynchronousTask): sys.stderr = stderr_orig portage.output.havecolor = global_havecolor - msg = _unicode_decode(out.getvalue(), - encoding=_encodings['content'], errors='replace') + msg = out.getvalue() if msg: self.scheduler.output(msg, log_path=self.logfile, background=self.background) diff --git a/pym/_emerge/EbuildFetcher.py b/pym/_emerge/EbuildFetcher.py index f67819c16..c076288cc 100644 --- a/pym/_emerge/EbuildFetcher.py +++ b/pym/_emerge/EbuildFetcher.py @@ -189,8 +189,7 @@ class EbuildFetcher(SpawnProcess): out = io.StringIO() for line in lines: eerror(line, phase="unpack", key=self.pkg.cpv, out=out) - msg = _unicode_decode(out.getvalue(), - encoding=_encodings['content'], errors='replace') + msg = out.getvalue() if msg: self.scheduler.output(msg, log_path=self.logfile) diff --git a/pym/_emerge/EbuildPhase.py b/pym/_emerge/EbuildPhase.py index c7f5b8827..f53570a5b 100644 --- a/pym/_emerge/EbuildPhase.py +++ b/pym/_emerge/EbuildPhase.py @@ -25,7 +25,6 @@ portage.proxy.lazyimport.lazyimport(globals(), ) from portage import os from portage import _encodings -from portage import _unicode_decode from portage import _unicode_encode class EbuildPhase(CompositeTask): @@ -193,8 +192,7 @@ class EbuildPhase(CompositeTask): if self.phase == "install": out = io.StringIO() _check_build_log(self.settings, out=out) - msg = _unicode_decode(out.getvalue(), - encoding=_encodings['content'], errors='replace') + msg = out.getvalue() self.scheduler.output(msg, log_path=logfile) if fail: @@ -208,8 +206,7 @@ class EbuildPhase(CompositeTask): out = io.StringIO() _post_src_install_chost_fix(settings) _post_src_install_uid_fix(settings, out) - msg = _unicode_decode(out.getvalue(), - encoding=_encodings['content'], errors='replace') + msg = out.getvalue() if msg: self.scheduler.output(msg, log_path=logfile) elif self.phase == "preinst": @@ -263,8 +260,7 @@ class EbuildPhase(CompositeTask): if self.phase == "install": out = io.StringIO() _post_src_install_soname_symlinks(self.settings, out) - msg = _unicode_decode(out.getvalue(), - encoding=_encodings['content'], errors='replace') + msg = out.getvalue() if msg: self.scheduler.output(msg, log_path=log_path) @@ -344,8 +340,7 @@ class EbuildPhase(CompositeTask): elog_func(line, phase=phase, key=self.settings.mycpv, out=out) finally: portage.output.havecolor = global_havecolor - msg = _unicode_decode(out.getvalue(), - encoding=_encodings['content'], errors='replace') + msg = out.getvalue() if msg: log_path = None if self.settings.get("PORTAGE_BACKGROUND") != "subprocess": diff --git a/pym/portage/package/ebuild/_ipc/QueryCommand.py b/pym/portage/package/ebuild/_ipc/QueryCommand.py index 5e1533f99..fb6e61e06 100644 --- a/pym/portage/package/ebuild/_ipc/QueryCommand.py +++ b/pym/portage/package/ebuild/_ipc/QueryCommand.py @@ -5,7 +5,6 @@ import io import portage from portage import os -from portage import _encodings from portage import _unicode_decode from portage.dep import Atom from portage.elog import messages as elog_messages @@ -95,6 +94,5 @@ class QueryCommand(IpcCommand): elog_func(line, phase=phase, key=self.settings.mycpv, out=out) finally: portage.output.havecolor = global_havecolor - msg = _unicode_decode(out.getvalue(), - encoding=_encodings['content'], errors='replace') + msg = out.getvalue() return msg -- 2.26.2