Skip to content

Commit

Permalink
Merge pull request #1113 from qwcode/fix_1106
Browse files Browse the repository at this point in the history
let --download work with wheels
  • Loading branch information
qwcode committed Aug 6, 2013
2 parents 901b46c + 5fcf4ab commit 4b1f064
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pip/req.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,13 @@ def prepare_files(self, finder, force_root_egg_info=False, bundle=False):
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:/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
Expand All @@ -1117,11 +1124,6 @@ def prepare_files(self, finder, force_root_egg_info=False, bundle=False):
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()
Expand Down
15 changes: 15 additions & 0 deletions tests/functional/test_install_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:/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
Expand Down

0 comments on commit 4b1f064

Please sign in to comment.