Skip to content

Commit

Permalink
Pass link to _fetch_metadata instead of req
Browse files Browse the repository at this point in the history
Removes dependence on `InstallRequirement`.
  • Loading branch information
chrahunt committed Aug 2, 2020
1 parent 21db4f3 commit c7ade15
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/pip/_internal/operations/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,12 +459,10 @@ def _get_linked_req_hashes(self, req):
# showing the user what the hash should be.
return req.hashes(trust_internet=False) or MissingHashes()

def _fetch_metadata(preparer, req):
# type: (InstallRequirement) -> Optional[Distribution]
def _fetch_metadata(preparer, link):
# type: (Link) -> Optional[Distribution]
"""Fetch metadata, using lazy wheel if possible."""
use_lazy_wheel = preparer.use_lazy_wheel
assert req.link
link = req.link
remote_wheel = link.is_wheel and not link.is_file
if use_lazy_wheel and remote_wheel and not preparer.require_hashes:
wheel = Wheel(link.filename)
Expand All @@ -486,7 +484,7 @@ def prepare_linked_requirement(self, req, parallel_builds=False):
assert req.link
link = req.link
self._log_preparing_link(req)
wheel_dist = self._fetch_metadata(req)
wheel_dist = self._fetch_metadata(link)
if wheel_dist is not None:
return wheel_dist
if link.is_wheel and self.wheel_download_dir:
Expand Down

0 comments on commit c7ade15

Please sign in to comment.