Commit 3430324f authored by PJ Eby's avatar PJ Eby

Fix for http://bugs.python.org/setuptools/issue7 (backport from trunk)

--HG--
branch : setuptools-0.6
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4065943
parent 22071a62
......@@ -220,7 +220,8 @@ class PackageIndex(Environment):
map(self.add, dists)
def url_ok(self, url, fatal=False):
if self.allows(urlparse.urlparse(url)[1]):
s = URL_SCHEME(url)
if (s and s.group(1).lower()=='file') or self.allows(urlparse.urlparse(url)[1]):
return True
msg = "\nLink to % s ***BLOCKED*** by --allow-hosts\n"
if fatal:
......@@ -243,7 +244,6 @@ class PackageIndex(Environment):
dist.precedence = SOURCE_DIST
self.add(dist)
def process_index(self,url,page):
"""Process the contents of a PyPI page"""
def scan(link):
......
......@@ -17,3 +17,11 @@ class TestPackageIndex(unittest.TestCase):
self.assert_(url in str(v))
else:
self.assert_(isinstance(v,urllib2.HTTPError))
def test_url_ok(self):
index = setuptools.package_index.PackageIndex(
hosts=('www.example.com',)
)
url = 'file:///tmp/test_package_index'
self.assert_(index.url_ok(url, True))
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