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.
@@ -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
