From afdcf7552cc7afc26ff2f793f3c50e4b9172c1b6 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Mon, 17 Sep 2007 19:48:57 -0500 Subject: Allow rankmirrors to read from stdin Feature Request #8043 and provided patch. Thanks! Signed-off-by: Dan McGee --- scripts/rankmirrors.py.in | 8 ++++++-- 1 file 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...' -- cgit v1.2.3