1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

let --download work with wheels

This commit is contained in:
Marcus Smith 2013-08-05 21:27:41 -07:00
parent 84480ac9b7
commit 5fcf4ab6f4
2 changed files with 22 additions and 5 deletions

View file

@ -1102,6 +1102,13 @@ class RequirementSet(object):
for subreq in req_to_install.bundle_requirements():
reqs.append(subreq)
self.add_requirement(subreq)
elif self.is_download:
req_to_install.source_dir = location
if not is_wheel:
# FIXME: see https://github.com/pypa/pip/issues/1112
req_to_install.run_egg_info()
if url and url.scheme in vcs.all_schemes:
req_to_install.archive(self.download_dir)
elif is_wheel:
req_to_install.source_dir = location
req_to_install.url = url.url
@ -1117,11 +1124,6 @@ class RequirementSet(object):
req_to_install)
reqs.append(subreq)
self.add_requirement(subreq)
elif self.is_download:
req_to_install.source_dir = location
req_to_install.run_egg_info()
if url and url.scheme in vcs.all_schemes:
req_to_install.archive(self.download_dir)
else:
req_to_install.source_dir = location
req_to_install.run_egg_info()

View file

@ -15,6 +15,21 @@ def test_download_if_requested():
assert env.site_packages/ 'initools' not in result.files_created
def test_download_wheel():
"""
Test using "pip install --download" to download a *.whl archive.
FIXME: this test could use a local --find-links dir, but -d with local
--find-links has a bug https://github.com/pypa/pip/issues/1111
"""
env = reset_env()
result = run_pip('install', '--use-wheel',
'-f', 'https://bitbucket.org/pypa/pip-test-package/downloads',
'-d', '.', 'pip-test-package')
assert Path('scratch')/ 'pip_test_package-0.1.1-py2.py3-none-any.whl' in result.files_created
assert env.site_packages/ 'piptestpackage' not in result.files_created
def test_single_download_from_requirements_file():
"""
It should support download (in the scratch path) from PyPi from a requirements file