From 3990cd9a03aeb17ed8da94d0d62683d598e4e30c Mon Sep 17 00:00:00 2001 From: Albert Tugushev Date: Thu, 22 Aug 2019 00:29:39 +0300 Subject: [PATCH] Add compatibility for refactored PackageFinder The `get_best_candidate` has been renamed to `compute_best_candidate`, which now returns an instance of `BestCandidateResult`. See https://github.com/pypa/pip/pull/6787 --- piptools/repositories/pypi.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/piptools/repositories/pypi.py b/piptools/repositories/pypi.py index 056c09350..64c59b832 100644 --- a/piptools/repositories/pypi.py +++ b/piptools/repositories/pypi.py @@ -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(