Remove unneeded _unicode_decode for io.StringIO.
authorZac Medico <zmedico@gentoo.org>
Tue, 12 Jul 2011 17:32:09 +0000 (10:32 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 12 Jul 2011 17:32:09 +0000 (10:32 -0700)
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
pym/_emerge/BinpkgVerifier.py
pym/_emerge/EbuildFetcher.py
pym/_emerge/EbuildPhase.py
pym/portage/package/ebuild/_ipc/QueryCommand.py

index 49b85eba3f11431c1645cec4b089f541e1bff138..4147ecb7b2cb306aa312c31f5e77b3f15c6ee837 100644 (file)
@@ -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":
index 91dc8a7d3d7afcfc46021d49bb3707a1bc98b172..0052967f6539df25102542da038b74b8bccf7b68 100644 (file)
@@ -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)
index f67819c1687eff60438b9f026c1f088afeba81bd..c076288cc6ef39a39c8b7f060eed2ba6e424df39 100644 (file)
@@ -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)
 
index c7f5b8827b66cde420f141f4aa7a29a0c1f7cc99..f53570a5b8d6918c1bc8f1510388ff20b44c3318 100644 (file)
@@ -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":
index 5e1533f9967b8e4b2332888d0bcfa7b5d1e59ea7..fb6e61e06fd52b1f274e150f946d388bf1ae9064 100644 (file)
@@ -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