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

pym/portage.py

index fa9f37535a551a131903427f49a9bac38c15e44a..360abe4c1edad3ee451b3e533a1e379bb101a148 100644 (file)
@@ -2563,15 +2563,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 \