Remove python-2.6 StringIO.StringIO fallback.
authorZac Medico <zmedico@gentoo.org>
Tue, 12 Jul 2011 08:41:09 +0000 (01:41 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 12 Jul 2011 08:41:09 +0000 (01:41 -0700)
Since the io module in python-2.6 was broken when threading was
disabled, we needed to fall back from io.StringIO to StringIO.StringIO
in this case (typically just for Gentoo's stage1 and stage2 tarballs).
Now that python-2.7 is stable in stages and we rely on io.open() being
available, we can also rely on io.StringIO being available.

12 files changed:
bin/repoman
pym/_emerge/AbstractEbuildProcess.py
pym/_emerge/BinpkgVerifier.py
pym/_emerge/EbuildFetcher.py
pym/_emerge/EbuildPhase.py
pym/_emerge/JobStatusDisplay.py
pym/_emerge/Scheduler.py
pym/portage/__init__.py
pym/portage/dbapi/_MergeProcess.py
pym/portage/dbapi/vartree.py
pym/portage/package/ebuild/_ipc/QueryCommand.py
pym/portage/util/__init__.py

index 3e02036816653deb638c7b28a8770a8299064e02..f1fbc2444cd00c633890da89b41264bcc6c35cb6 100755 (executable)
@@ -55,7 +55,6 @@ from portage import os
 from portage import subprocess_getstatusoutput
 from portage import _encodings
 from portage import _unicode_encode
-from portage import StringIO
 from repoman.checks import run_checks
 from repoman import utilities
 from repoman.herdbase import make_herd_base
@@ -2011,7 +2010,7 @@ if dofail or \
 # in $EDITOR while the user creates a commit message.
 # Otherwise, the user would not be able to see this output
 # once the editor has taken over the screen.
-qa_output = StringIO()
+qa_output = io.StringIO()
 style_file = ConsoleStyleFile(sys.stdout)
 if options.mode == 'commit' and \
        (not commitmessage or not commitmessage.strip()):
index 0d1d991d49db5c8fa201320c84ec4e0b008811bf..49b85eba3f11431c1645cec4b089f541e1bff138 100644 (file)
@@ -1,7 +1,7 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-import platform
+import io
 import stat
 import textwrap
 from _emerge.SpawnProcess import SpawnProcess
@@ -13,7 +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 StringIO
 from portage import _encodings
 from portage import _unicode_decode
 from portage.util._pty import _create_pty_or_pipe
@@ -216,7 +215,7 @@ class AbstractEbuildProcess(SpawnProcess):
                self._elog('eerror', lines)
 
        def _elog(self, elog_funcname, lines):
-               out = StringIO()
+               out = io.StringIO()
                phase = self.phase
                elog_func = getattr(elog_messages, elog_funcname)
                global_havecolor = portage.output.havecolor
index 379c862af3de7d7c16fb27a130d5acac962ca2ac..91dc8a7d3d7afcfc46021d49bb3707a1bc98b172 100644 (file)
@@ -3,6 +3,7 @@
 
 from _emerge.AsynchronousTask import AsynchronousTask
 from portage.util import writemsg
+import io
 import sys
 import portage
 from portage import os
@@ -27,7 +28,7 @@ class BinpkgVerifier(AsynchronousTask):
                stdout_orig = sys.stdout
                stderr_orig = sys.stderr
                global_havecolor = portage.output.havecolor
-               out = portage.StringIO()
+               out = io.StringIO()
                file_exists = True
                try:
                        sys.stdout = out
index 51d2f5a104c6b84c4a32428d7c364719cf85cc3a..f67819c1687eff60438b9f026c1f088afeba81bd 100644 (file)
@@ -186,7 +186,7 @@ class EbuildFetcher(SpawnProcess):
                return (master_fd, slave_fd)
 
        def _eerror(self, lines):
-               out = portage.StringIO()
+               out = io.StringIO()
                for line in lines:
                        eerror(line, phase="unpack", key=self.pkg.cpv, out=out)
                msg = _unicode_decode(out.getvalue(),
index 64d33a8ca28077ac1ad304bfba22c1881d5f2bd5..c7f5b8827b66cde420f141f4aa7a29a0c1f7cc99 100644 (file)
@@ -2,6 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 
 import gzip
+import io
 import sys
 import tempfile
 
@@ -23,7 +24,6 @@ portage.proxy.lazyimport.lazyimport(globals(),
                '_preinst_bsdflags'
 )
 from portage import os
-from portage import StringIO
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
@@ -191,7 +191,7 @@ class EbuildPhase(CompositeTask):
                        logfile = self.settings.get("PORTAGE_LOG_FILE")
 
                if self.phase == "install":
-                       out = portage.StringIO()
+                       out = io.StringIO()
                        _check_build_log(self.settings, out=out)
                        msg = _unicode_decode(out.getvalue(),
                                encoding=_encodings['content'], errors='replace')
@@ -205,7 +205,7 @@ class EbuildPhase(CompositeTask):
                _post_phase_userpriv_perms(settings)
 
                if self.phase == "install":
-                       out = portage.StringIO()
+                       out = io.StringIO()
                        _post_src_install_chost_fix(settings)
                        _post_src_install_uid_fix(settings, out)
                        msg = _unicode_decode(out.getvalue(),
@@ -261,7 +261,7 @@ class EbuildPhase(CompositeTask):
                        return
 
                if self.phase == "install":
-                       out = portage.StringIO()
+                       out = io.StringIO()
                        _post_src_install_soname_symlinks(self.settings, out)
                        msg = _unicode_decode(out.getvalue(),
                                encoding=_encodings['content'], errors='replace')
@@ -333,7 +333,7 @@ class EbuildPhase(CompositeTask):
        def _elog(self, elog_funcname, lines, background=None):
                if background is None:
                        background = self.background
-               out = StringIO()
+               out = io.StringIO()
                phase = self.phase
                elog_func = getattr(elog_messages, elog_funcname)
                global_havecolor = portage.output.havecolor
index d3d330d304bbd3cea26bed1bce61083a6819f98d..1949232e7a04d6e57b83d20ddfe6d02c06077f01 100644 (file)
@@ -1,12 +1,12 @@
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import formatter
+import io
 import sys
 import time
 
 import portage
-from portage import StringIO
 from portage import os
 from portage import _encodings
 from portage import _unicode_decode
@@ -237,8 +237,8 @@ class JobStatusDisplay(object):
                failed_str = str(self.failed)
                load_avg_str = self._load_avg_str()
 
-               color_output = StringIO()
-               plain_output = StringIO()
+               color_output = io.StringIO()
+               plain_output = io.StringIO()
                style_file = portage.output.ConsoleStyleFile(color_output)
                style_file.write_listener = plain_output
                style_writer = portage.output.StyleWriter(file=style_file, maxcol=9999)
index b88e2c29be600ac84d8cdcb52a1ed33bee3a48ee..ad276e9bc6746bcdae4053cab40617557a5d568f 100644 (file)
@@ -18,7 +18,6 @@ import weakref
 import zlib
 
 import portage
-from portage import StringIO
 from portage import os
 from portage import _encodings
 from portage import _unicode_decode, _unicode_encode
index 38da8a0b23b66212be26105b4d0c47ec0b164ffd..5411ec9216883fa3692cbdc1b8601f3e5f3d0bf4 100644 (file)
@@ -22,14 +22,6 @@ try:
        except ImportError:
                from commands import getstatusoutput as subprocess_getstatusoutput
 
-       try:
-               from io import StringIO
-       except ImportError:
-               # Needed for python-2.6 with USE=build since
-               # io imports threading which imports thread
-               # which is unavailable.
-               from StringIO import StringIO
-
        import platform
 
        # Temporarily delete these imports, to ensure that only the
index 3b9ad8284b4651d27104636f42f7be84fedec823..34ed03157e30257c0c45bc74ec92fe3d0925a362 100644 (file)
@@ -1,16 +1,16 @@
 # Copyright 2010-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+import io
 import shutil
 import signal
-import sys
 import tempfile
 import traceback
 
 import errno
 import fcntl
 import portage
-from portage import os, StringIO, _unicode_decode
+from portage import os, _unicode_decode
 from portage.const import PORTAGE_PACKAGE_ATOM
 from portage.dep import match_from_list
 import portage.elog.messages
@@ -134,7 +134,7 @@ class MergeProcess(SpawnProcess):
                        else:
                                lines[0] = self._buf + lines[0]
                                self._buf = lines.pop()
-                               out = StringIO()
+                               out = io.StringIO()
                                for line in lines:
                                        funcname, phase, key, msg = line.split(' ', 3)
                                        self._elog_keys.add(key)
index d5c055420df83afe12c757942a9425a8cbbfa74c..bec3d6629a8970fc646e5782a7a6b6bbd116da2b 100644 (file)
@@ -2925,7 +2925,7 @@ class dblink(object):
                        log_path = None
                        if self.settings.get("PORTAGE_BACKGROUND") != "subprocess":
                                log_path = self.settings.get("PORTAGE_LOG_FILE")
-                       out = portage.StringIO()
+                       out = io.StringIO()
                        for line in lines:
                                func(line, phase=phase, key=self.mycpv, out=out)
                        msg = out.getvalue()
index 7d006acf0f0b7d0b00c56908444a7a281c54183a..5e1533f9967b8e4b2332888d0bcfa7b5d1e59ea7 100644 (file)
@@ -1,9 +1,10 @@
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+import io
+
 import portage
 from portage import os
-from portage import StringIO
 from portage import _encodings
 from portage import _unicode_decode
 from portage.dep import Atom
@@ -83,7 +84,7 @@ class QueryCommand(IpcCommand):
                don't want to corrupt it, especially if it is being written with
                compression.
                """
-               out = StringIO()
+               out = io.StringIO()
                phase = self.phase
                elog_func = getattr(elog_messages, elog_funcname)
                global_havecolor = portage.output.havecolor
index b641d3ed2a2e6597cba37e51b5a25b386812f256..4aa63d5e37a22a7a191ee99b46584dd5b06cbfb5 100644 (file)
@@ -32,7 +32,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
        'portage.dep:Atom',
        'portage.util.listdir:_ignorecvs_dirs'
 )
-from portage import StringIO
+
 from portage import os
 from portage import subprocess_getstatusoutput
 from portage import _encodings
@@ -63,7 +63,7 @@ def writemsg(mystr,noiselevel=0,fd=None):
                fd = sys.stderr
        if noiselevel <= noiselimit:
                # avoid potential UnicodeEncodeError
-               if isinstance(fd, StringIO):
+               if isinstance(fd, io.StringIO):
                        mystr = _unicode_decode(mystr,
                                encoding=_encodings['content'], errors='replace')
                else:
@@ -521,7 +521,7 @@ class _tolerant_shlex(shlex.shlex):
                except EnvironmentError as e:
                        writemsg(_("!!! Parse error in '%s': source command failed: %s\n") % \
                                (self.infile, str(e)), noiselevel=-1)
-                       return (newfile, StringIO())
+                       return (newfile, io.StringIO())
 
 _invalid_var_name_re = re.compile(r'^\d|\W')