Permalink
Browse files

Merge pull request #1527 from qwcode/wheel_deps

fixes for downloading wheels (Issue #1112)
  • Loading branch information...
qwcode committed Feb 2, 2014
2 parents 386d1b9 + 4af1008 commit 3311a449d26f23b7b7fab15b61e691f2bd619bde
@@ -381,30 +381,9 @@ def prepare_files(self, finder, force_root_egg_info=False, bundle=False):
req_to_install.run_egg_info()
if url and url.scheme in vcs.all_schemes:
req_to_install.archive(self.download_dir)
##############################
## parse wheel dependencies ##
##############################
elif is_wheel:
req_to_install.source_dir = location
req_to_install.url = url.url
dist = list(
pkg_resources.find_distributions(location)
)[0]
if not req_to_install.req:
req_to_install.req = dist.as_requirement()
self.add_requirement(req_to_install)
if not self.ignore_dependencies:
for subreq in dist.requires(
req_to_install.extras):
if self.has_requirement(
subreq.project_name):
continue
subreq = InstallRequirement(str(subreq),
req_to_install)
reqs.append(subreq)
self.add_requirement(subreq)
else:
req_to_install.source_dir = location
req_to_install.run_egg_info()
@@ -444,11 +423,30 @@ def prepare_files(self, finder, force_root_egg_info=False, bundle=False):
)
install = False
##############################
## parse sdist dependencies ##
##############################
########################
## parse dependencies ##
########################
if is_wheel:
dist = list(
pkg_resources.find_distributions(location)
)[0]
if not req_to_install.req:
req_to_install.req = dist.as_requirement()
self.add_requirement(req_to_install)
if not self.ignore_dependencies:
for subreq in dist.requires(
req_to_install.extras):
if self.has_requirement(
subreq.project_name):
continue
subreq = InstallRequirement(str(subreq),
req_to_install)
reqs.append(subreq)
self.add_requirement(subreq)
if not (is_bundle or is_wheel):
# sdists
elif not is_bundle:
## FIXME: shouldn't be globally added:
finder.add_dependency_links(
req_to_install.dependency_links
@@ -482,12 +480,14 @@ def prepare_files(self, finder, force_root_egg_info=False, bundle=False):
if not self.has_requirement(req_to_install.name):
#'unnamed' requirements will get added here
self.add_requirement(req_to_install)
if (self.is_download
or req_to_install._temp_build_dir is not None):
self.reqs_to_cleanup.append(req_to_install)
else:
self.reqs_to_cleanup.append(req_to_install)
# cleanup tmp src
if not is_bundle:
if (
self.is_download or
req_to_install._temp_build_dir is not None
):
self.reqs_to_cleanup.append(req_to_install)
if install:
self.successfully_downloaded.append(req_to_install)
if (bundle
Binary file not shown.
Binary file not shown.
@@ -1,3 +1,4 @@
import os
import textwrap
from tests.lib.path import Path
@@ -63,6 +64,34 @@ def test_download_should_download_dependencies(script):
assert script.site_packages / 'openid' not in result.files_created
def test_download_wheel_archive(script, data):
"""
It should download a wheel archive path
"""
wheel_filename = 'colander-0.9.9-py2.py3-none-any.whl'
wheel_path = os.path.join(data.find_links, wheel_filename)
result = script.pip(
'install', wheel_path,
'-d', '.', '--no-deps'
)
assert Path('scratch') / wheel_filename in result.files_created
def test_download_should_download_wheel_deps(script, data):
"""
It should download dependencies for wheels(in the scratch path)
"""
wheel_filename = 'colander-0.9.9-py2.py3-none-any.whl'
dep_filename = 'translationstring-1.1.tar.gz'
wheel_path = os.path.join(data.find_links, wheel_filename)
result = script.pip(
'install', wheel_path,
'-d', '.', '--find-links', data.find_links, '--no-index'
)
assert Path('scratch') / wheel_filename in result.files_created
assert Path('scratch') / dep_filename in result.files_created
def test_download_should_skip_existing_files(script):
"""
It should not download files already existing in the scratch dir

0 comments on commit 3311a44

Please sign in to comment.