Skip to content

Commit

Permalink
Rename variable for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Apr 16, 2020
1 parent 84b99c2 commit 9c97b28
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/pip/_internal/resolution/resolvelib/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,18 @@ def iter_found_candidates(self, ireq, extras):
# type: (InstallRequirement, Set[str]) -> Iterator[Candidate]
name = canonicalize_name(ireq.req.name)
if not self._force_reinstall:
dist = self._installed_dists.get(name)
installed_dist = self._installed_dists.get(name)
else:
dist = None
installed_dist = None

found = self.finder.find_best_candidate(
project_name=ireq.req.name,
specifier=ireq.req.specifier,
hashes=ireq.hashes(trust_internet=False),
)
for ican in found.iter_applicable():
if dist is not None and dist.parsed_version == ican.version:
if (installed_dist is not None and
installed_dist.parsed_version == ican.version):
continue
yield self._make_candidate_from_link(
link=ican.link,
Expand All @@ -131,9 +132,10 @@ def iter_found_candidates(self, ireq, extras):

# Return installed distribution if it matches the specifier. This is
# done last so the resolver will prefer it over downloading links.
if dist is not None and dist.parsed_version in ireq.req.specifier:
if (installed_dist is not None and
installed_dist.parsed_version in ireq.req.specifier):
yield self._make_candidate_from_dist(
dist=dist,
dist=installed_dist,
extras=extras,
parent=ireq,
)
Expand Down

0 comments on commit 9c97b28

Please sign in to comment.