Skip to content

Commit 9225d2b

Browse files
committed
Merge pull request #830 from kankri/develop
PIP_FIND_LINKS doesn't cope with spaces, work around with file:// URLs.
2 parents ee5acce + 6650bc6 commit 9225d2b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

virtualenv.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,20 @@ def install_wheel(project_names, py_executable, search_dirs=None,
821821

822822
wheels = find_wheels(['setuptools', 'pip'], search_dirs)
823823
pythonpath = os.pathsep.join(wheels)
824-
findlinks = ' '.join(search_dirs)
824+
825+
# PIP_FIND_LINKS uses space as the path separator and thus cannot have paths
826+
# with spaces in them. Convert any of those to local file:// URL form.
827+
try:
828+
from urlparse import urljoin
829+
from urllib import pathname2url
830+
except ImportError:
831+
from urllib.parse import urljoin
832+
from urllib.request import pathname2url
833+
def space_path2url(p):
834+
if ' ' not in p:
835+
return p
836+
return urljoin('file:', pathname2url(os.path.abspath(p)))
837+
findlinks = ' '.join(space_path2url(d) for d in search_dirs)
825838

826839
cmd = [
827840
py_executable, '-c',

0 commit comments

Comments
 (0)