summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphillip.eby <phillip.eby@6015fed2-1504-0410-9fe1-9d1591cc4771>2008-08-21 17:55:32 +0000
committerphillip.eby <phillip.eby@6015fed2-1504-0410-9fe1-9d1591cc4771>2008-08-21 17:55:32 +0000
commitc94e11f946f84997600c5adf204cc739caee802d (patch)
treef99c18a8f6343697cc29da39bd398af483eabee2
parent0c6e5beadeffada4ffce5e1a3ca0da78c2574a13 (diff)
downloadpython-setuptools-c94e11f946f84997600c5adf204cc739caee802d.tar.gz
Fix for http://bugs.python.org/setuptools/issue7
git-svn-id: http://svn.python.org/projects/sandbox/trunk/setuptools@65942 6015fed2-1504-0410-9fe1-9d1591cc4771
-rwxr-xr-xsetuptools/package_index.py4
-rw-r--r--setuptools/tests/test_packageindex.py8
2 files changed, 10 insertions, 2 deletions
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index fed36a8..84f1fce 100755
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -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):
diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py
index 2d619a0..0231eda 100644
--- a/setuptools/tests/test_packageindex.py
+++ b/setuptools/tests/test_packageindex.py
@@ -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))
+