diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-02-20 07:16:16 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-02-20 07:16:16 +0000 |
commit | ff11bfce39a7b86c0d00ecc2d3909665c58dc85d (patch) | |
tree | 7fa47c05d6a69e6a096855a8c12ab76edf4e64ca /pym/portage | |
parent | fb05e64acc278e4395b4209e2219c404b3697252 (diff) | |
download | portage-ff11bfce39a7b86c0d00ecc2d3909665c58dc85d.tar.gz portage-ff11bfce39a7b86c0d00ecc2d3909665c58dc85d.tar.bz2 portage-ff11bfce39a7b86c0d00ecc2d3909665c58dc85d.zip |
Fix StringIO imports so that 2to3 can handle them. Also, replace shlex +
StringIO usage with shlex.split() where appropriate.
svn path=/main/trunk/; revision=12662
Diffstat (limited to 'pym/portage')
-rw-r--r-- | pym/portage/__init__.py | 7 | ||||
-rw-r--r-- | pym/portage/getbinpkg.py | 7 | ||||
-rw-r--r-- | pym/portage/util.py | 6 |
3 files changed, 9 insertions, 11 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 621daa7be..3be6e651f 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -4079,10 +4079,9 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", "URI": loc, "FILE": myfile } - import shlex, StringIO - lexer = shlex.shlex(StringIO.StringIO(locfetch), posix=True) - lexer.whitespace_split = True - myfetch = [varexpand(x, mydict=variables) for x in lexer] + import shlex + myfetch = shlex.split(locfetch) + myfetch = [varexpand(x, mydict=variables) for x in myfetch] myret = -1 try: diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py index f657c67a1..bb3911a6b 100644 --- a/pym/portage/getbinpkg.py +++ b/pym/portage/getbinpkg.py @@ -400,12 +400,11 @@ def file_get(baseurl,dest,conn=None,fcmd=None): "URI": baseurl, "FILE": os.path.basename(baseurl) } - import shlex, StringIO + import shlex from portage.util import varexpand from portage.process import spawn - lexer = shlex.shlex(StringIO.StringIO(fcmd), posix=True) - lexer.whitespace_split = True - myfetch = [varexpand(x, mydict=variables) for x in lexer] + myfetch = shlex.split(fcmd) + myfetch = [varexpand(x, mydict=variables) for x in myfetch] fd_pipes= { 0:sys.stdin.fileno(), 1:sys.stdout.fileno(), diff --git a/pym/portage/util.py b/pym/portage/util.py index 54df38192..eaab1bf4a 100644 --- a/pym/portage/util.py +++ b/pym/portage/util.py @@ -23,9 +23,9 @@ except ImportError: import pickle try: - import cStringIO as StringIO + from cStringIO import StringIO except ImportError: - import StringIO + from StringIO import StringIO noiselimit = 0 @@ -500,7 +500,7 @@ class _tolerant_shlex(shlex.shlex): except EnvironmentError, e: writemsg("!!! Parse error in '%s': source command failed: %s\n" % \ (self.infile, str(e)), noiselevel=-1) - return (newfile, StringIO.StringIO()) + return (newfile, StringIO()) class _insert_newline_eof(ObjectProxy): """ |