[Collab-qa-commits] r2067 - multi-arch

Jakub Wilk jwilk at alioth.debian.org
Sat Oct 29 14:13:19 UTC 2011


Author: jwilk
Date: 2011-10-29 14:13:18 +0000 (Sat, 29 Oct 2011)
New Revision: 2067

Modified:
   multi-arch/multi-arch-same-validator
Log:
Allow using a local mirror.


Modified: multi-arch/multi-arch-same-validator
===================================================================
--- multi-arch/multi-arch-same-validator	2011-10-29 09:33:25 UTC (rev 2066)
+++ multi-arch/multi-arch-same-validator	2011-10-29 14:13:18 UTC (rev 2067)
@@ -7,6 +7,7 @@
 import argparse
 import collections
 import os
+import pipes
 import re
 import sys
 import subprocess as ipc
@@ -45,9 +46,16 @@
 
     def __enter__(self):
         log_download(self._url)
-        commandline = 'wget -O- -q {url}'.format(url=self._url)
-        if self._pipe is not None:
-            commandline += ' | ' + self._pipe
+        quoted_url = pipes.quote(self._url)
+        if self._url.startswith(('/', '.')):
+            if self._pipe is not None:
+                commandline = '< {url} {pipe}'.format(url=quoted_url, pipe=self._pipe)
+            else:
+                commandline = 'cat {url}'.format(url=quoted_url)
+        else:
+            commandline = 'wget -O- -q {url}'.format(url=quoted_url)
+            if self._pipe is not None:
+                commandline += ' | ' + self._pipe
         self._child = ipc.Popen(commandline, shell=True, stdout=ipc.PIPE)
         return self._child.stdout
 




More information about the Collab-qa-commits mailing list