from stat import S_ISDIR, ST_CTIME
try:
- import cStringIO as StringIO
+ from cStringIO import StringIO
except ImportError:
- import StringIO
+ from StringIO import StringIO
if not hasattr(__builtins__, "set"):
from sets import Set as set
# 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.StringIO()
+qa_output = StringIO()
style_file = ConsoleStyleFile(sys.stdout)
if options.mode == 'commit' and \
(not commitmessage or not commitmessage.strip()):
import pickle
try:
- import cStringIO as StringIO
+ from cStringIO import StringIO
except ImportError:
- import StringIO
+ from StringIO import StringIO
class stdout_spinner(object):
scroll_msgs = [
failed_str = str(self.failed)
load_avg_str = self._load_avg_str()
- color_output = StringIO.StringIO()
- plain_output = StringIO.StringIO()
+ color_output = StringIO()
+ plain_output = StringIO()
style_file = portage.output.ConsoleStyleFile(color_output)
style_file.write_listener = plain_output
style_writer = portage.output.StyleWriter(file=style_file, maxcol=9999)
mytimeout=180
rsync_opts = []
- import shlex, StringIO
if settings["PORTAGE_RSYNC_OPTS"] == "":
portage.writemsg("PORTAGE_RSYNC_OPTS empty or unset, using hardcoded defaults\n")
rsync_opts.extend([
# defaults.
portage.writemsg("Using PORTAGE_RSYNC_OPTS instead of hardcoded defaults\n", 1)
- lexer = shlex.shlex(StringIO.StringIO(
- settings.get("PORTAGE_RSYNC_OPTS","")), posix=True)
- lexer.whitespace_split = True
- rsync_opts.extend(lexer)
- del lexer
-
+ rsync_opts.extend(
+ shlex.split(settings.get("PORTAGE_RSYNC_OPTS","")))
for opt in ("--recursive", "--times"):
if opt not in rsync_opts:
portage.writemsg(yellow("WARNING:") + " adding required option " + \
user_name=""
updatecache_flg=True
all_rsync_opts = set(rsync_opts)
- lexer = shlex.shlex(StringIO.StringIO(
- settings.get("PORTAGE_RSYNC_EXTRA_OPTS","")), posix=True)
- lexer.whitespace_split = True
- extra_rsync_opts = list(lexer)
- del lexer
+ extra_rsync_opts = shlex.split(
+ settings.get("PORTAGE_RSYNC_EXTRA_OPTS",""))
all_rsync_opts.update(extra_rsync_opts)
family = socket.AF_INET
if "-4" in all_rsync_opts or "--ipv4" in all_rsync_opts:
"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:
"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(),
import pickle
try:
- import cStringIO as StringIO
+ from cStringIO import StringIO
except ImportError:
- import StringIO
+ from StringIO import StringIO
noiselimit = 0
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):
"""