Move _fetch_metadata into _prepare

Since `_prepare` is called in two places, we preserve the
`if self._dist is not None` protection above the new call to
`_fetch_metadata`. The second `if` in `_prepare` handles the early
return required when processing a lazy wheel.
This commit is contained in:
Chris Hunt 2020-08-02 11:11:00 -04:00
parent 4d94ae4c40
commit 8c3c0ade78
1 changed files with 3 additions and 1 deletions

View File

@ -216,6 +216,9 @@ class _InstallRequirementBackedCandidate(Candidate):
def _prepare(self):
# type: () -> None
if self._dist is not None:
return
self._fetch_metadata()
if self._dist is not None:
return
try:
@ -253,7 +256,6 @@ class _InstallRequirementBackedCandidate(Candidate):
def dist(self):
# type: () -> Distribution
if self._dist is None:
self._fetch_metadata()
self._prepare()
return self._dist