summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Johnson <tam-al@hiddenrock.com>2007-09-17 19:48:57 -0500
committerDan McGee <dan@archlinux.org>2007-09-17 19:48:57 -0500
commitafdcf7552cc7afc26ff2f793f3c50e4b9172c1b6 (patch)
treebff70ed1b83b130d38b019905bd251d9215ef4c5
parentacfdad6db3ac6c934d8f1885b37520680a610bec (diff)
downloadpacman-afdcf7552cc7afc26ff2f793f3c50e4b9172c1b6.tar.xz
Allow rankmirrors to read from stdin
Feature Request #8043 and provided patch. Thanks! Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--scripts/rankmirrors.py.in8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/rankmirrors.py.in b/scripts/rankmirrors.py.in
index 04a490ac..0c50bdd8 100644
--- a/scripts/rankmirrors.py.in
+++ b/scripts/rankmirrors.py.in
@@ -121,11 +121,15 @@ if __name__ == "__main__":
print args[0], ':', "%.2f" % serverToTime
sys.exit(0)
- if not os.path.isfile(args[0]):
+ if not os.path.isfile(args[0]) and args[0] != "-":
print >>sys.stderr, 'rankmirrors: file', args[0], 'does not exist.'
sys.exit(1)
- fl = open(args[0], 'r')
+ if args[0] == "-":
+ fl = sys.stdin
+ else:
+ fl = open(args[0], 'r')
+
serverToTime = {}
if options.times:
print 'Querying servers, this may take some time...'