mirror of https://github.com/pypa/pip
Prepare lazy wheels more so they are downloaded
This keeps all knowledge about preparation and types of requirements in `RequirementPreparer`, so there's one place to look when we're ready to start breaking it apart later.
This commit is contained in:
parent
c7ade159d4
commit
8b838ebb89
|
@ -486,7 +486,21 @@ class RequirementPreparer(object):
|
||||||
self._log_preparing_link(req)
|
self._log_preparing_link(req)
|
||||||
wheel_dist = self._fetch_metadata(link)
|
wheel_dist = self._fetch_metadata(link)
|
||||||
if wheel_dist is not None:
|
if wheel_dist is not None:
|
||||||
|
req.needs_more_preparation = True
|
||||||
return wheel_dist
|
return wheel_dist
|
||||||
|
return self._prepare_linked_requirement(req, parallel_builds)
|
||||||
|
|
||||||
|
def prepare_linked_requirement_more(self, req, parallel_builds=False):
|
||||||
|
# type: (InstallRequirement, bool) -> None
|
||||||
|
"""Prepare a linked requirement more, if needed."""
|
||||||
|
if not req.needs_more_preparation:
|
||||||
|
return
|
||||||
|
self._prepare_linked_requirement(req, parallel_builds)
|
||||||
|
|
||||||
|
def _prepare_linked_requirement(self, req, parallel_builds):
|
||||||
|
# type: (InstallRequirement, bool) -> Distribution
|
||||||
|
assert req.link
|
||||||
|
link = req.link
|
||||||
if link.is_wheel and self.wheel_download_dir:
|
if link.is_wheel and self.wheel_download_dir:
|
||||||
# Download wheels to a dedicated dir when doing `pip wheel`.
|
# Download wheels to a dedicated dir when doing `pip wheel`.
|
||||||
download_dir = self.wheel_download_dir
|
download_dir = self.wheel_download_dir
|
||||||
|
|
|
@ -213,6 +213,9 @@ class InstallRequirement(object):
|
||||||
# but after loading this flag should be treated as read only.
|
# but after loading this flag should be treated as read only.
|
||||||
self.use_pep517 = use_pep517
|
self.use_pep517 = use_pep517
|
||||||
|
|
||||||
|
# This requirement needs more preparation before it can be built
|
||||||
|
self.needs_more_preparation = False
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
# type: () -> str
|
# type: () -> str
|
||||||
if self.req:
|
if self.req:
|
||||||
|
|
|
@ -159,6 +159,9 @@ class Resolver(BaseResolver):
|
||||||
|
|
||||||
req_set.add_named_requirement(ireq)
|
req_set.add_named_requirement(ireq)
|
||||||
|
|
||||||
|
for actual_req in req_set.all_requirements:
|
||||||
|
self.factory.preparer.prepare_linked_requirement_more(actual_req)
|
||||||
|
|
||||||
return req_set
|
return req_set
|
||||||
|
|
||||||
def get_installation_order(self, req_set):
|
def get_installation_order(self, req_set):
|
||||||
|
|
Loading…
Reference in New Issue