summaryrefslogtreecommitdiffstats
path: root/pym/portage
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-07-12 01:41:09 -0700
committerZac Medico <zmedico@gentoo.org>2011-07-12 01:41:09 -0700
commit5df96179611ce0e98727945b1800b43daccedfc2 (patch)
treee60d86543cf61b8f8fa93858c4068b2305a6769b /pym/portage
parent428053ee44e4a14b3c74dc8e541bcb062b31a799 (diff)
downloadportage-5df96179611ce0e98727945b1800b43daccedfc2.tar.gz
portage-5df96179611ce0e98727945b1800b43daccedfc2.tar.bz2
portage-5df96179611ce0e98727945b1800b43daccedfc2.zip
Remove python-2.6 StringIO.StringIO fallback.
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.
Diffstat (limited to 'pym/portage')
-rw-r--r--pym/portage/__init__.py8
-rw-r--r--pym/portage/dbapi/_MergeProcess.py6
-rw-r--r--pym/portage/dbapi/vartree.py2
-rw-r--r--pym/portage/package/ebuild/_ipc/QueryCommand.py7
-rw-r--r--pym/portage/util/__init__.py6
5 files changed, 11 insertions, 18 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 38da8a0b2..5411ec921 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -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
diff --git a/pym/portage/dbapi/_MergeProcess.py b/pym/portage/dbapi/_MergeProcess.py
index 3b9ad8284..34ed03157 100644
--- a/pym/portage/dbapi/_MergeProcess.py
+++ b/pym/portage/dbapi/_MergeProcess.py
@@ -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)
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index d5c055420..bec3d6629 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -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()
diff --git a/pym/portage/package/ebuild/_ipc/QueryCommand.py b/pym/portage/package/ebuild/_ipc/QueryCommand.py
index 7d006acf0..5e1533f99 100644
--- a/pym/portage/package/ebuild/_ipc/QueryCommand.py
+++ b/pym/portage/package/ebuild/_ipc/QueryCommand.py
@@ -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
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index b641d3ed2..4aa63d5e3 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -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')