summaryrefslogtreecommitdiff
path: root/scripts/rankmirrors
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-02-22 08:06:54 +0000
committerDan McGee <dan@archlinux.org>2007-02-22 08:06:54 +0000
commit3cda6f4f6b92f18d2bd23de77a5b53030d7d150c (patch)
tree04de8ac2c4262e10013964a9d776d9359b0efbc5 /scripts/rankmirrors
parentcd2309eb735d4e7880ccaedfd3935a4b52d4e394 (diff)
* Rewrote pactest with an OptionParser so we can have helpful help text, and
bumped the version to 0.4. Still a work in progress. * Changed some linewraps in rankmirrors to keep everything under 80 chars.
Diffstat (limited to 'scripts/rankmirrors')
-rw-r--r--scripts/rankmirrors24
1 files changed, 14 insertions, 10 deletions
diff --git a/scripts/rankmirrors b/scripts/rankmirrors
index 90bcad87..5bec6498 100644
--- a/scripts/rankmirrors
+++ b/scripts/rankmirrors
@@ -25,16 +25,19 @@ from optparse import OptionParser
def createOptParser():
usage = "usage: %prog [options] MIRRORFILE | URL"
- description = "Ranks pacman mirrors by their connection and opening speed. Pacman mirror files are located in /etc/pacman.d/. It can also rank one mirror if the URL is provided."
- parser = OptionParser(usage=usage,description=description)
- parser.add_option("-f", "--formatted", action="store_true",
- dest = "formatted", default=False, help="output in mirror file format")
- parser.add_option("-n", dest="num", default=0,
- help="number of servers to output, 0 for all")
- parser.add_option("-u", "--url", action="store_true", dest="url",
+ description = "Ranks pacman mirrors by their connection and opening " \
+ "speed. Pacman mirror files are located in /etc/pacman.d/. It " \
+ "can also rank one mirror if the URL is provided."
+ parser = OptionParser(usage = usage, description = description)
+ parser.add_option("-f", "--formatted", action = "store_true",
+ dest = "formatted", default = False,
+ help = "output in mirror file format")
+ parser.add_option("-n", type = "int", dest = "num", default = 0,
+ help = "number of servers to output, 0 for all")
+ parser.add_option("-u", "--url", action = "store_true", dest = "url",
default=False, help="test a specific url")
- parser.add_option("-v", "--verbose", action="store_true", dest="verbose",
- default=False, help="be verbose in output")
+ parser.add_option("-v", "--verbose", action = "store_true",
+ dest = "verbose", default = False, help ="be verbose in output")
return parser
def timeCmd(cmd):
@@ -86,7 +89,8 @@ if __name__ == "__main__":
fl = open(args[0], 'r')
serverToTime = {}
if options.formatted:
- print "# Server list generated by rankmirrors on", datetime.date.today()
+ print "# Server list generated by rankmirrors on",
+ print datetime.date.today()
else:
print 'Querying servers, this may take some time...'
for ln in fl.readlines():