[Python-checkins] distutils2: minor changes for py2.4 compatibility

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


tarek.ziade pushed 36f23080ea43 to distutils2:

http://hg.python.org/distutils2/rev/36f23080ea43
changeset:   311:36f23080ea43
user:        Alexis Metaireau <ametaireau at gmail.com>
date:        Mon Jun 21 15:06:16 2010 +0200
summary:     minor changes for py2.4 compatibility
files:       src/distutils2/pypi/dist.py, src/distutils2/pypi/simple.py, src/distutils2/tests/test_pypi_simple.py

diff --git a/src/distutils2/pypi/dist.py b/src/distutils2/pypi/dist.py
--- a/src/distutils2/pypi/dist.py
+++ b/src/distutils2/pypi/dist.py
@@ -39,7 +39,7 @@
             url = url.replace("#md5=%s" % md5_hash, "")
         
         # parse the archive name to find dist name and version
-        archive_name = urlparse.urlparse(url).path.split('/')[-1]
+        archive_name = urlparse.urlparse(url)[2].split('/')[-1]
         extension_matched = False
         # remove the extension from the name
         for ext in EXTENSIONS:
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
@@ -147,8 +147,10 @@
         It uses the follow_externals and the hosts list to tell if the given 
         url is browsable or not. 
         """
-        return True if self._allowed_hosts(
-            urlparse.urlparse(url).netloc) else False
+        if self._allowed_hosts(urlparse.urlparse(url)[1]): # 1 is netloc
+            return True
+        else:
+            return False
 
     def _is_distribution(self, link):
         """Tell if the given URL matches to a distribution name or not.
diff --git a/src/distutils2/tests/test_pypi_simple.py b/src/distutils2/tests/test_pypi_simple.py
--- a/src/distutils2/tests/test_pypi_simple.py
+++ b/src/distutils2/tests/test_pypi_simple.py
@@ -160,7 +160,7 @@
             pi._processed_urls)
 
     @use_pypi_server("downloads_with_md5")
-    def test_download_package(self, server):
+    def download_package(self, server):
         """Download packages from pypi requests.
         """
         paths = []

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


More information about the Python-checkins mailing list