diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-01-11 19:30:07 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-01-11 19:30:07 +0100 |
| commit | b237760c6d7009f9833b86e6dbfc3cbf6d059977 (patch) | |
| tree | 19dd8f4f11b1c004a7f9bbb2b9e9f545d0ed2492 /utils | |
| parent | 31cdfa2e20361f76f6e011bbcdad19f9daa1f58f (diff) | |
| parent | 7b14352c54b7acbf2a68240fa960e188c6e8742a (diff) | |
| download | python-apt-b237760c6d7009f9833b86e6dbfc3cbf6d059977.tar.gz | |
Merge Ben Finney's whitespace changes (Closes: #481563)
Diffstat (limited to 'utils')
| -rwxr-xr-x | utils/get_debian_mirrors.py | 2 | ||||
| -rwxr-xr-x | utils/get_ubuntu_mirrors.py | 10 | ||||
| -rwxr-xr-x | utils/get_ubuntu_mirrors_from_lp.py | 3 | ||||
| -rwxr-xr-x | utils/mirrortest | 4 |
4 files changed, 11 insertions, 8 deletions
diff --git a/utils/get_debian_mirrors.py b/utils/get_debian_mirrors.py index 512731ed..2e3c7296 100755 --- a/utils/get_debian_mirrors.py +++ b/utils/get_debian_mirrors.py @@ -39,11 +39,13 @@ req = urllib2.Request("http://www.debian.org/mirror/mirrors_full") match = re.compile("^.*>([A-Za-z0-9-.\/_]+)<\/a>.*\n$") match_location = re.compile('^<strong><a name="([A-Z]+)">.*') + def add_sites(line, proto, sites, mirror_type): path = match.sub(r"\1", line) for site in sites: mirror_type.append("%s://%s%s\n" % (proto, site.lstrip(), path)) + try: print "Downloading mirrors list from the Debian website..." uri=urllib2.urlopen(req) diff --git a/utils/get_ubuntu_mirrors.py b/utils/get_ubuntu_mirrors.py index 605edcf5..ddd1e369 100755 --- a/utils/get_ubuntu_mirrors.py +++ b/utils/get_ubuntu_mirrors.py @@ -42,10 +42,10 @@ try: uri=urllib2.urlopen(req) p = re.compile('^.*((http|ftp):\/\/[A-Za-z0-9-.:\/_]+).*\n*$') for line in uri.readlines(): - if r"[[Anchor(dvd-images)]]" in line: - break - if "http://" in line or "ftp://" in line: - mirrors.append(p.sub(r"\1", line)) + if r"[[Anchor(dvd-images)]]" in line: + break + if "http://" in line or "ftp://" in line: + mirrors.append(p.sub(r"\1", line)) uri.close() except: print "Failed to download or extract the mirrors list!" @@ -57,5 +57,3 @@ for mirror in mirrors: list.write("%s\n" % mirror) list.close() print "Done." - - diff --git a/utils/get_ubuntu_mirrors_from_lp.py b/utils/get_ubuntu_mirrors_from_lp.py index 1f41e34b..59ddd84e 100755 --- a/utils/get_ubuntu_mirrors_from_lp.py +++ b/utils/get_ubuntu_mirrors_from_lp.py @@ -64,6 +64,8 @@ content_splits = re.split(r'<tr class="highlighted"', 'id="mirrors_list">.+?</table>', content)[0]) lines=[] + + def find(split): country = re.search(r"<strong>(.+?)</strong>", split) if not country: @@ -78,6 +80,7 @@ def find(split): split) map(lambda u: lines.append(u[0]), urls) + map(find, content_splits) print "Writing local mirrors list: %s" % list_path diff --git a/utils/mirrortest b/utils/mirrortest index 75ef917b..a724c81f 100755 --- a/utils/mirrortest +++ b/utils/mirrortest @@ -24,8 +24,8 @@ class MirrorTest: host = mirror.hostname except: continue - print "Pinging (Worker %s) %s (%s) ..." % (self.id, - host, + print "Pinging (Worker %s) %s (%s) ..." % (self.id, + host, MirrorTest.completed_pings) commando = os.popen("ping -q -c 4 -W 2 -i 0.3 %s" % host, "r") |
