Use shlex for better splitting of FETCHCOMMAND.
authorZac Medico <zmedico@gentoo.org>
Sun, 6 May 2007 19:37:37 +0000 (19:37 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 6 May 2007 19:37:37 +0000 (19:37 -0000)
svn path=/main/trunk/; revision=6490

pym/portage/__init__.py

index 89c0fee58c3a93a0e70569efcc65750bc610bca7..4cdfebe6fecf7b6e8ada175e7fe209de7c177be8 100644 (file)
@@ -2630,15 +2630,15 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
                                                locfetch=fetchcommand
                                        writemsg_stdout(">>> Downloading '%s'\n" % \
                                                re.sub(r'//(.+):.+@(.+)/',r'//\1:*password*@\2/', loc))
-                                       myfetch = locfetch.split()
                                        variables = {
                                                "DISTDIR": mysettings["DISTDIR"],
                                                "URI":     loc,
                                                "FILE":    myfile
                                        }
-                                       
-                                       for i in xrange(len(myfetch)):
-                                               myfetch[i] = varexpand(myfetch[i], mydict=variables)
+                                       import shlex, StringIO
+                                       lexer = shlex.shlex(StringIO.StringIO(locfetch), posix=True)
+                                       lexer.whitespace_split = True
+                                       myfetch = [varexpand(x, mydict=variables) for x in lexer]
 
                                        spawn_keywords = {}
                                        if "userfetch" in mysettings.features and \