diff options
author | Peter Johnson <tam-al@hiddenrock.com> | 2007-09-18 02:48:57 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-09-18 02:48:57 +0200 |
commit | afdcf7552cc7afc26ff2f793f3c50e4b9172c1b6 (patch) | |
tree | bff70ed1b83b130d38b019905bd251d9215ef4c5 /scripts | |
parent | acfdad6db3ac6c934d8f1885b37520680a610bec (diff) | |
download | pacman-afdcf7552cc7afc26ff2f793f3c50e4b9172c1b6.tar.gz pacman-afdcf7552cc7afc26ff2f793f3c50e4b9172c1b6.tar.xz |
Allow rankmirrors to read from stdin
Feature Request #8043 and provided patch. Thanks!
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/rankmirrors.py.in | 8 |
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...' |