diff options
author | Tarek Ziade <tarek@ziade.org> | 2010-05-19 12:09:56 +0200 |
---|---|---|
committer | Tarek Ziade <tarek@ziade.org> | 2010-05-19 12:09:56 +0200 |
commit | a33917aed3c98e2537386bd904658f0b4f963d1c (patch) | |
tree | 627de7b5a1d4234a808b453a78dc8399e1d70381 /setuptools | |
parent | 24773fa31a13fc0058aed577d566cb528a769061 (diff) | |
download | external_python_setuptools-a33917aed3c98e2537386bd904658f0b4f963d1c.tar.gz external_python_setuptools-a33917aed3c98e2537386bd904658f0b4f963d1c.tar.bz2 external_python_setuptools-a33917aed3c98e2537386bd904658f0b4f963d1c.zip |
malformed urls in 2.7 are catched now - fixes #160
--HG--
branch : distribute
extra : rebase_source : de334e49e876c8ea88f738e03995a461ea669879
Diffstat (limited to 'setuptools')
-rwxr-xr-x | setuptools/package_index.py | 5 | ||||
-rw-r--r-- | setuptools/tests/test_packageindex.py | 12 |
2 files changed, 15 insertions, 2 deletions
diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 924c15e1..1c50d86f 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -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: diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py index 29359a9c..8ae7a5b9 100644 --- a/setuptools/tests/test_packageindex.py +++ b/setuptools/tests/test_packageindex.py @@ -1,7 +1,7 @@ """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',) |