Commit a33917ae authored by Tarek Ziade's avatar Tarek Ziade

malformed urls in 2.7 are catched now - fixes #160

--HG--
branch : distribute
extra : rebase_source : de334e49e876c8ea88f738e03995a461ea669879
parent 24773fa3
......@@ -6,6 +6,7 @@ CHANGES
0.6.13
------
* Issue 160: 2.7 gives ValueError("Invalid IPv6 URL")
*
------
......
......@@ -268,7 +268,10 @@ class PackageIndex(Environment):
# 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:
......
"""Package Index Tests
"""
# More would be better!
import sys
import os, shutil, tempfile, unittest, urllib2
import pkg_resources
import setuptools.package_index
......@@ -57,6 +57,16 @@ class TestPackageIndex(unittest.TestCase):
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',)
......
......@@ -2,6 +2,8 @@ python2.3 setup.py -q test
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment