Commits

Tarek Ziadé committed e5d2a60

malformed urls in 2.7 are catched now - fixes #160

Comments (0)

Files changed (4)

 0.6.13
 ------
 
+* Issue 160: 2.7 gives ValueError("Invalid IPv6 URL")
 *
 
 ------

setuptools/package_index.py

 
         # process an index page into the package-page index
         for match in HREF.finditer(page):
-            scan( urlparse.urljoin(url, htmldecode(match.group(1))) )
+            try:
+                scan( urlparse.urljoin(url, htmldecode(match.group(1))) )
+            except ValueError:
+                pass
 
         pkg, ver = scan(url)   # ensure this page is in the page index
         if pkg:

setuptools/tests/test_packageindex.py

 """Package Index Tests
 """
 # More would be better!
-
+import sys
 import os, shutil, tempfile, unittest, urllib2
 import pkg_resources
 import setuptools.package_index
         except Exception, v:
             self.assert_('nonnumeric port' in str(v))
 
+
+        # issue #160
+        if sys.version_info[0] == 2 and sys.version_info[1] == 7:
+            # this should not fail
+            url = 'http://example.com'
+            page = ('<a href="http://www.famfamfam.com]('
+                    'http://www.famfamfam.com/">')
+            index.process_index(url, page)
+
+
     def test_url_ok(self):
         index = setuptools.package_index.PackageIndex(
             hosts=('www.example.com',)
 python2.4 setup.py -q test
 python2.5 setup.py -q test
 python2.6 setup.py -q test
+python2.7 setup.py -q test
+
 rm -rf build
 python3.1 setup.py -q test