summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-01-13 17:22:27 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2009-01-13 17:22:27 +0100
commit38d602dc83006c51dfe4ed594d691ea9b0679498 (patch)
treeb7aedfba82c44cad6c3012f879b5d6d7e8ad1425 /utils
parent12cf58d12b969010f3d98b2974d72bbb950b775f (diff)
parent614897f798d9f16591fbd29ebe2a6c5674102d2d (diff)
downloadpython-apt-38d602dc83006c51dfe4ed594d691ea9b0679498.tar.gz
* apt/*.py:
- Almost complete cleanup of the code - Remove inconsistent use of tabs and spaces (Closes: #505443) - Improved documentation * apt/debfile.py: - Drop get*() methods, as they are deprecated and were never in a stable release - Make DscSrcPackage working * apt/gtk/widgets.py: - Fix the code and document the signals * Introduce new documentation build with Sphinx - Contains style Guide (Closes: #481562) - debian/rules: Build the documentation here - setup.py: Remove pydoc building and add new docs. - debian/examples: Include examples from documentation - debian/python-apt.docs: + Change html/ to build/doc/html. + Add build/doc/text for the text-only documentation * setup.py: - Only create build/data when building, not all the time - Remove build/mo and build/data on clean -a * debian/control: - Remove the Conflicts on python2.3-apt, python2.4-apt, as they are only needed for oldstable (sarge) - Build-Depend on python-sphinx (>= 0.5) * aptsources/distinfo.py: - Allow @ in mirror urls (Closes: #478171) (LP: #223097) * Merge Ben Finney's whitespace changes (Closes: #481563) * Merge Ben Finney's do not use has_key() (Closes: #481878) * Do not use deprecated form of raise statement (Closes: #494259) * Add support for PkgRecords.SHA256Hash (Closes: #456113)
Diffstat (limited to 'utils')
-rwxr-xr-xutils/get_debian_mirrors.py14
-rwxr-xr-xutils/get_ubuntu_mirrors.py20
-rwxr-xr-xutils/get_ubuntu_mirrors_from_lp.py15
-rwxr-xr-xutils/mirrortest4
4 files changed, 28 insertions, 25 deletions
diff --git a/utils/get_debian_mirrors.py b/utils/get_debian_mirrors.py
index ccddf8ed..2e3c7296 100755
--- a/utils/get_debian_mirrors.py
+++ b/utils/get_debian_mirrors.py
@@ -2,23 +2,23 @@
#
# get_debian_mirrors.py
#
-# Download the latest list with available mirrors from the Debian
+# Download the latest list with available mirrors from the Debian
# website and extract the hosts from the raw page
#
# Copyright (c) 2006 Free Software Foundation Europe
#
# Author: Sebastian Heinlein <glatzor@ubuntu.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -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 62b18ba6..ddd1e369 100755
--- a/utils/get_ubuntu_mirrors.py
+++ b/utils/get_ubuntu_mirrors.py
@@ -8,17 +8,17 @@
# Copyright (c) 2006 Free Software Foundation Europe
#
# Author: Sebastian Heinlein <glatzor@ubuntu.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -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 7d9116f2..b912f28d 100755
--- a/utils/get_ubuntu_mirrors_from_lp.py
+++ b/utils/get_ubuntu_mirrors_from_lp.py
@@ -8,17 +8,17 @@
# Copyright (c) 2006 Free Software Foundation Europe
#
# Author: Sebastian Heinlein <glatzor@ubuntu.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -64,11 +64,13 @@ 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:
return
- if countries.has_key(country.group(1)):
+ if country.group(1) in countries:
lines.append("#LOC:%s" % countries[country.group(1)].upper())
else:
lines.append("#LOC:%s" % country.group(1))
@@ -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")