summaryrefslogtreecommitdiff
path: root/utils/get_debian_mirrors.py
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2015-07-05 22:06:22 +0300
committerIgor Pashev <pashev.igor@gmail.com>2015-07-05 22:06:22 +0300
commit622812485150fa7864910ee2f710d5aab2fa9e6d (patch)
treeb3bc4fd72bb80e74ba5a60d8b3d47e610dff012e /utils/get_debian_mirrors.py
parent798846ab8337471998b0a4d796d6d409453faa7d (diff)
parentfdd173dd444098ed533cbcd541a7f10f228bc47e (diff)
downloadpython-apt-622812485150fa7864910ee2f710d5aab2fa9e6d.tar.gz
Merge git://anonscm.debian.org/apt/python-apt
Conflicts: debian/changelog python/apt_pkgmodule.cc
Diffstat (limited to 'utils/get_debian_mirrors.py')
-rwxr-xr-xutils/get_debian_mirrors.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/utils/get_debian_mirrors.py b/utils/get_debian_mirrors.py
index c1ec3be8..de4ebb95 100755
--- a/utils/get_debian_mirrors.py
+++ b/utils/get_debian_mirrors.py
@@ -17,7 +17,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
+from __future__ import print_function
import collections
+import sys
import urllib2
from debian_bundle import deb822
@@ -27,7 +29,7 @@ masterlist = urllib2.urlopen("http://anonscm.debian.org/viewvc/"
"mirror/Mirrors.masterlist?revision=HEAD")
for mirror in deb822.Deb822.iter_paragraphs(masterlist):
- if not "Country" in mirror:
+ if "Country" not in mirror:
continue
country = mirror["Country"].split(None, 1)[0]
site = mirror["Site"]
@@ -36,6 +38,10 @@ for mirror in deb822.Deb822.iter_paragraphs(masterlist):
mirrors[country].add("%s://%s%s" % (proto, site,
mirror["Archive-%s" % proto]))
+if len(mirrors) == 0:
+ sys.stderr.write("E: Could not read the mirror list due to "
+ "some unknown issue\n")
+ sys.exit(1)
for country in sorted(mirrors):
- print "#LOC:%s" % country
- print "\n".join(sorted(mirrors[country]))
+ print("#LOC:%s" % country)
+ print("\n".join(sorted(mirrors[country])))