[Python-checkins] distutils2: Set the mirror list fallback to an empty list if problems occurs while getting

tarek.ziade python-checkins at python.org
Sun Jul 4 11:48:40 CEST 2010


tarek.ziade pushed 880201efc140 to distutils2:

http://hg.python.org/distutils2/rev/880201efc140
changeset:   345:880201efc140
user:        Alexis Metaireau <ametaireau at gmail.com>
date:        Fri Jul 02 18:28:20 2010 +0200
summary:     Set the mirror list fallback to an empty list if problems occurs while getting
files:       src/distutils2/pypi/simple.py

diff --git a/src/distutils2/pypi/simple.py b/src/distutils2/pypi/simple.py
--- a/src/distutils2/pypi/simple.py
+++ b/src/distutils2/pypi/simple.py
@@ -94,7 +94,10 @@
         self._index_urls = [index_url]
         # if no mirrors are defined, use the method described in PEP 381.
         if mirrors is None:
-            mirrors = socket.gethostbyname_ex(mirrors_url)[-1]
+            try:
+                mirrors = socket.gethostbyname_ex(mirrors_url)[-1]
+            except socket.gaierror:
+                mirrors = []
         self._index_urls.extend(mirrors)
         self._current_index_url = 0
         self._timeout = timeout

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list