Skip to content

Commit

Permalink
Add compatibility for refactored PackageFinder
Browse files Browse the repository at this point in the history
The `get_best_candidate` has been renamed to `compute_best_candidate`,
which now returns an instance of `BestCandidateResult`.

See pypa/pip#6787
  • Loading branch information
atugushev committed Sep 17, 2019
1 parent 73619fb commit 3990cd9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion piptools/repositories/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,15 @@ def find_best_match(self, ireq, prereleases=None):
elif PIP_VERSION < (19, 2):
evaluator = self.finder.candidate_evaluator
best_candidate = evaluator.get_best_candidate(matching_candidates)
else:
elif PIP_VERSION < (19, 3):
evaluator = self.finder.make_candidate_evaluator(ireq.name)
best_candidate = evaluator.get_best_candidate(matching_candidates)
else:
evaluator = self.finder.make_candidate_evaluator(ireq.name)
best_candidate_result = evaluator.compute_best_candidate(
matching_candidates
)
best_candidate = best_candidate_result.best_candidate

# Turn the candidate into a pinned InstallRequirement
return make_install_requirement(
Expand Down

0 comments on commit 3990cd9

Please sign in to comment.