summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2009-08-31 20:34:03 +0200
committerJannis Leidel <jannis@leidel.info>2009-08-31 20:34:03 +0200
commit8922a1ead4c503e85e6ad03c7c1fe236258e0554 (patch)
treed8ed11c2836c0d0d8fd663de25b2be0cf328775c
parent62df4c2d4ad839af1660b6d30d8c18b7899565a6 (diff)
downloadpip-8922a1ead4c503e85e6ad03c7c1fe236258e0554.tar.gz
Fixed the --find-links option on Windows by unquoting the URL path seperators
-rw-r--r--pip.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/pip.py b/pip.py
index e578dd1dd..c5d24e559 100644
--- a/pip.py
+++ b/pip.py
@@ -406,8 +406,7 @@ class InstallCommand(Command):
dest='ignore_dependencies',
action='store_true',
default=False,
- help='Ignore package dependencies',
- )
+ help='Ignore package dependencies')
self.parser.add_option(
'--no-install',
dest='no_install',
@@ -1115,11 +1114,12 @@ class PackageFinder(object):
path = os.path.realpath(fn)
for item in os.listdir(path):
file_locations.append(
- filename_to_url(os.path.join(path, item)))
+ filename_to_url2(os.path.join(path, item)))
elif os.path.isfile(fn):
- file_locations.append(url)
+ file_locations.append(filename_to_url2(fn))
else:
url_locations.append(url)
+
locations = [Link(url) for url in url_locations]
logger.debug('URLs to search for versions for %s:' % req)
for location in locations:
@@ -4043,6 +4043,19 @@ def filename_to_url(filename):
url = url.lstrip('/')
return 'file:///' + url
+def filename_to_url2(filename):
+ """
+ Convert a path to a file: URL. The path will be made absolute and have
+ quoted path parts.
+ """
+ filename = os.path.normcase(os.path.abspath(filename))
+ drive, filename = os.path.splitdrive(filename)
+ filepath = filename.split(os.path.sep)
+ url = '/'.join([urllib.quote(part) for part in filepath])
+ if not drive:
+ url = url.lstrip('/')
+ return 'file:///' + drive + url
+
def url_to_filename(url):
"""
Convert a file: URL to a path.