Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/_ipc/, pym/portage/dbapi/, bin/, pym/portage/, ...
Date: Tue, 12 Jul 2011 08:41:49
Message-Id: 5df96179611ce0e98727945b1800b43daccedfc2.zmedico@gentoo
1 commit: 5df96179611ce0e98727945b1800b43daccedfc2
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jul 12 08:41:09 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 12 08:41:09 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5df96179
7
8 Remove python-2.6 StringIO.StringIO fallback.
9
10 Since the io module in python-2.6 was broken when threading was
11 disabled, we needed to fall back from io.StringIO to StringIO.StringIO
12 in this case (typically just for Gentoo's stage1 and stage2 tarballs).
13 Now that python-2.7 is stable in stages and we rely on io.open() being
14 available, we can also rely on io.StringIO being available.
15
16 ---
17 bin/repoman | 3 +--
18 pym/_emerge/AbstractEbuildProcess.py | 5 ++---
19 pym/_emerge/BinpkgVerifier.py | 3 ++-
20 pym/_emerge/EbuildFetcher.py | 2 +-
21 pym/_emerge/EbuildPhase.py | 10 +++++-----
22 pym/_emerge/JobStatusDisplay.py | 8 ++++----
23 pym/_emerge/Scheduler.py | 1 -
24 pym/portage/__init__.py | 8 --------
25 pym/portage/dbapi/_MergeProcess.py | 6 +++---
26 pym/portage/dbapi/vartree.py | 2 +-
27 pym/portage/package/ebuild/_ipc/QueryCommand.py | 7 ++++---
28 pym/portage/util/__init__.py | 6 +++---
29 12 files changed, 26 insertions(+), 35 deletions(-)
30
31 diff --git a/bin/repoman b/bin/repoman
32 index 3e02036..f1fbc24 100755
33 --- a/bin/repoman
34 +++ b/bin/repoman
35 @@ -55,7 +55,6 @@ from portage import os
36 from portage import subprocess_getstatusoutput
37 from portage import _encodings
38 from portage import _unicode_encode
39 -from portage import StringIO
40 from repoman.checks import run_checks
41 from repoman import utilities
42 from repoman.herdbase import make_herd_base
43 @@ -2011,7 +2010,7 @@ if dofail or \
44 # in $EDITOR while the user creates a commit message.
45 # Otherwise, the user would not be able to see this output
46 # once the editor has taken over the screen.
47 -qa_output = StringIO()
48 +qa_output = io.StringIO()
49 style_file = ConsoleStyleFile(sys.stdout)
50 if options.mode == 'commit' and \
51 (not commitmessage or not commitmessage.strip()):
52
53 diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
54 index 0d1d991..49b85eb 100644
55 --- a/pym/_emerge/AbstractEbuildProcess.py
56 +++ b/pym/_emerge/AbstractEbuildProcess.py
57 @@ -1,7 +1,7 @@
58 # Copyright 1999-2011 Gentoo Foundation
59 # Distributed under the terms of the GNU General Public License v2
60
61 -import platform
62 +import io
63 import stat
64 import textwrap
65 from _emerge.SpawnProcess import SpawnProcess
66 @@ -13,7 +13,6 @@ from portage.localization import _
67 from portage.package.ebuild._ipc.ExitCommand import ExitCommand
68 from portage.package.ebuild._ipc.QueryCommand import QueryCommand
69 from portage import os
70 -from portage import StringIO
71 from portage import _encodings
72 from portage import _unicode_decode
73 from portage.util._pty import _create_pty_or_pipe
74 @@ -216,7 +215,7 @@ class AbstractEbuildProcess(SpawnProcess):
75 self._elog('eerror', lines)
76
77 def _elog(self, elog_funcname, lines):
78 - out = StringIO()
79 + out = io.StringIO()
80 phase = self.phase
81 elog_func = getattr(elog_messages, elog_funcname)
82 global_havecolor = portage.output.havecolor
83
84 diff --git a/pym/_emerge/BinpkgVerifier.py b/pym/_emerge/BinpkgVerifier.py
85 index 379c862..91dc8a7 100644
86 --- a/pym/_emerge/BinpkgVerifier.py
87 +++ b/pym/_emerge/BinpkgVerifier.py
88 @@ -3,6 +3,7 @@
89
90 from _emerge.AsynchronousTask import AsynchronousTask
91 from portage.util import writemsg
92 +import io
93 import sys
94 import portage
95 from portage import os
96 @@ -27,7 +28,7 @@ class BinpkgVerifier(AsynchronousTask):
97 stdout_orig = sys.stdout
98 stderr_orig = sys.stderr
99 global_havecolor = portage.output.havecolor
100 - out = portage.StringIO()
101 + out = io.StringIO()
102 file_exists = True
103 try:
104 sys.stdout = out
105
106 diff --git a/pym/_emerge/EbuildFetcher.py b/pym/_emerge/EbuildFetcher.py
107 index 51d2f5a..f67819c 100644
108 --- a/pym/_emerge/EbuildFetcher.py
109 +++ b/pym/_emerge/EbuildFetcher.py
110 @@ -186,7 +186,7 @@ class EbuildFetcher(SpawnProcess):
111 return (master_fd, slave_fd)
112
113 def _eerror(self, lines):
114 - out = portage.StringIO()
115 + out = io.StringIO()
116 for line in lines:
117 eerror(line, phase="unpack", key=self.pkg.cpv, out=out)
118 msg = _unicode_decode(out.getvalue(),
119
120 diff --git a/pym/_emerge/EbuildPhase.py b/pym/_emerge/EbuildPhase.py
121 index 64d33a8..c7f5b88 100644
122 --- a/pym/_emerge/EbuildPhase.py
123 +++ b/pym/_emerge/EbuildPhase.py
124 @@ -2,6 +2,7 @@
125 # Distributed under the terms of the GNU General Public License v2
126
127 import gzip
128 +import io
129 import sys
130 import tempfile
131
132 @@ -23,7 +24,6 @@ portage.proxy.lazyimport.lazyimport(globals(),
133 '_preinst_bsdflags'
134 )
135 from portage import os
136 -from portage import StringIO
137 from portage import _encodings
138 from portage import _unicode_decode
139 from portage import _unicode_encode
140 @@ -191,7 +191,7 @@ class EbuildPhase(CompositeTask):
141 logfile = self.settings.get("PORTAGE_LOG_FILE")
142
143 if self.phase == "install":
144 - out = portage.StringIO()
145 + out = io.StringIO()
146 _check_build_log(self.settings, out=out)
147 msg = _unicode_decode(out.getvalue(),
148 encoding=_encodings['content'], errors='replace')
149 @@ -205,7 +205,7 @@ class EbuildPhase(CompositeTask):
150 _post_phase_userpriv_perms(settings)
151
152 if self.phase == "install":
153 - out = portage.StringIO()
154 + out = io.StringIO()
155 _post_src_install_chost_fix(settings)
156 _post_src_install_uid_fix(settings, out)
157 msg = _unicode_decode(out.getvalue(),
158 @@ -261,7 +261,7 @@ class EbuildPhase(CompositeTask):
159 return
160
161 if self.phase == "install":
162 - out = portage.StringIO()
163 + out = io.StringIO()
164 _post_src_install_soname_symlinks(self.settings, out)
165 msg = _unicode_decode(out.getvalue(),
166 encoding=_encodings['content'], errors='replace')
167 @@ -333,7 +333,7 @@ class EbuildPhase(CompositeTask):
168 def _elog(self, elog_funcname, lines, background=None):
169 if background is None:
170 background = self.background
171 - out = StringIO()
172 + out = io.StringIO()
173 phase = self.phase
174 elog_func = getattr(elog_messages, elog_funcname)
175 global_havecolor = portage.output.havecolor
176
177 diff --git a/pym/_emerge/JobStatusDisplay.py b/pym/_emerge/JobStatusDisplay.py
178 index d3d330d..1949232 100644
179 --- a/pym/_emerge/JobStatusDisplay.py
180 +++ b/pym/_emerge/JobStatusDisplay.py
181 @@ -1,12 +1,12 @@
182 -# Copyright 1999-2009 Gentoo Foundation
183 +# Copyright 1999-2011 Gentoo Foundation
184 # Distributed under the terms of the GNU General Public License v2
185
186 import formatter
187 +import io
188 import sys
189 import time
190
191 import portage
192 -from portage import StringIO
193 from portage import os
194 from portage import _encodings
195 from portage import _unicode_decode
196 @@ -237,8 +237,8 @@ class JobStatusDisplay(object):
197 failed_str = str(self.failed)
198 load_avg_str = self._load_avg_str()
199
200 - color_output = StringIO()
201 - plain_output = StringIO()
202 + color_output = io.StringIO()
203 + plain_output = io.StringIO()
204 style_file = portage.output.ConsoleStyleFile(color_output)
205 style_file.write_listener = plain_output
206 style_writer = portage.output.StyleWriter(file=style_file, maxcol=9999)
207
208 diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
209 index b88e2c2..ad276e9 100644
210 --- a/pym/_emerge/Scheduler.py
211 +++ b/pym/_emerge/Scheduler.py
212 @@ -18,7 +18,6 @@ import weakref
213 import zlib
214
215 import portage
216 -from portage import StringIO
217 from portage import os
218 from portage import _encodings
219 from portage import _unicode_decode, _unicode_encode
220
221 diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
222 index 38da8a0..5411ec9 100644
223 --- a/pym/portage/__init__.py
224 +++ b/pym/portage/__init__.py
225 @@ -22,14 +22,6 @@ try:
226 except ImportError:
227 from commands import getstatusoutput as subprocess_getstatusoutput
228
229 - try:
230 - from io import StringIO
231 - except ImportError:
232 - # Needed for python-2.6 with USE=build since
233 - # io imports threading which imports thread
234 - # which is unavailable.
235 - from StringIO import StringIO
236 -
237 import platform
238
239 # Temporarily delete these imports, to ensure that only the
240
241 diff --git a/pym/portage/dbapi/_MergeProcess.py b/pym/portage/dbapi/_MergeProcess.py
242 index 3b9ad82..34ed031 100644
243 --- a/pym/portage/dbapi/_MergeProcess.py
244 +++ b/pym/portage/dbapi/_MergeProcess.py
245 @@ -1,16 +1,16 @@
246 # Copyright 2010-2011 Gentoo Foundation
247 # Distributed under the terms of the GNU General Public License v2
248
249 +import io
250 import shutil
251 import signal
252 -import sys
253 import tempfile
254 import traceback
255
256 import errno
257 import fcntl
258 import portage
259 -from portage import os, StringIO, _unicode_decode
260 +from portage import os, _unicode_decode
261 from portage.const import PORTAGE_PACKAGE_ATOM
262 from portage.dep import match_from_list
263 import portage.elog.messages
264 @@ -134,7 +134,7 @@ class MergeProcess(SpawnProcess):
265 else:
266 lines[0] = self._buf + lines[0]
267 self._buf = lines.pop()
268 - out = StringIO()
269 + out = io.StringIO()
270 for line in lines:
271 funcname, phase, key, msg = line.split(' ', 3)
272 self._elog_keys.add(key)
273
274 diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
275 index d5c0554..bec3d66 100644
276 --- a/pym/portage/dbapi/vartree.py
277 +++ b/pym/portage/dbapi/vartree.py
278 @@ -2925,7 +2925,7 @@ class dblink(object):
279 log_path = None
280 if self.settings.get("PORTAGE_BACKGROUND") != "subprocess":
281 log_path = self.settings.get("PORTAGE_LOG_FILE")
282 - out = portage.StringIO()
283 + out = io.StringIO()
284 for line in lines:
285 func(line, phase=phase, key=self.mycpv, out=out)
286 msg = out.getvalue()
287
288 diff --git a/pym/portage/package/ebuild/_ipc/QueryCommand.py b/pym/portage/package/ebuild/_ipc/QueryCommand.py
289 index 7d006ac..5e1533f 100644
290 --- a/pym/portage/package/ebuild/_ipc/QueryCommand.py
291 +++ b/pym/portage/package/ebuild/_ipc/QueryCommand.py
292 @@ -1,9 +1,10 @@
293 -# Copyright 2010 Gentoo Foundation
294 +# Copyright 2010-2011 Gentoo Foundation
295 # Distributed under the terms of the GNU General Public License v2
296
297 +import io
298 +
299 import portage
300 from portage import os
301 -from portage import StringIO
302 from portage import _encodings
303 from portage import _unicode_decode
304 from portage.dep import Atom
305 @@ -83,7 +84,7 @@ class QueryCommand(IpcCommand):
306 don't want to corrupt it, especially if it is being written with
307 compression.
308 """
309 - out = StringIO()
310 + out = io.StringIO()
311 phase = self.phase
312 elog_func = getattr(elog_messages, elog_funcname)
313 global_havecolor = portage.output.havecolor
314
315 diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
316 index b641d3e..4aa63d5 100644
317 --- a/pym/portage/util/__init__.py
318 +++ b/pym/portage/util/__init__.py
319 @@ -32,7 +32,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
320 'portage.dep:Atom',
321 'portage.util.listdir:_ignorecvs_dirs'
322 )
323 -from portage import StringIO
324 +
325 from portage import os
326 from portage import subprocess_getstatusoutput
327 from portage import _encodings
328 @@ -63,7 +63,7 @@ def writemsg(mystr,noiselevel=0,fd=None):
329 fd = sys.stderr
330 if noiselevel <= noiselimit:
331 # avoid potential UnicodeEncodeError
332 - if isinstance(fd, StringIO):
333 + if isinstance(fd, io.StringIO):
334 mystr = _unicode_decode(mystr,
335 encoding=_encodings['content'], errors='replace')
336 else:
337 @@ -521,7 +521,7 @@ class _tolerant_shlex(shlex.shlex):
338 except EnvironmentError as e:
339 writemsg(_("!!! Parse error in '%s': source command failed: %s\n") % \
340 (self.infile, str(e)), noiselevel=-1)
341 - return (newfile, StringIO())
342 + return (newfile, io.StringIO())
343
344 _invalid_var_name_re = re.compile(r'^\d|\W')