Skip to content

Commit

Permalink
Float wheels to the top of the candidate sort order
Browse files Browse the repository at this point in the history
- `ignore_compatibility` is meant to resolve hashes into the lockfile
  after resolution happens
- We still want compatible items to be the ones we actually tell pip to
  install
- Fixes #4231

Signed-off-by: Dan Ryan <dan.ryan@canonical.com>
  • Loading branch information
techalchemy committed May 8, 2020
1 parent 9ab617a commit 7059a26
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions news/4231.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a bug which caused pipenv to prefer source distributions over wheels from ``PyPI`` during the dependency resolution phase.
2 changes: 1 addition & 1 deletion pipenv/patched/notpip/_internal/index/package_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ def _sort_key(self, candidate, ignore_compatibility=True):
)
if self._prefer_binary:
binary_preference = 1
tags = self.valid_tags if not ignore_compatibility else None
tags = valid_tags
try:
pri = -(wheel.support_index_min(tags=tags))
except TypeError:
Expand Down
4 changes: 2 additions & 2 deletions tasks/vendoring/patches/patched/pip20.patch
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ index 02a187c8..f917e645 100644
modifying_pip=modifying_pip
)
diff --git a/pipenv/patched/pip/_internal/index/package_finder.py b/pipenv/patched/pip/_internal/index/package_finder.py
index a74d78db..11128f4d 100644
index a74d78db..7c9dc1be 100644
--- a/pipenv/patched/pip/_internal/index/package_finder.py
+++ b/pipenv/patched/pip/_internal/index/package_finder.py
@@ -121,6 +121,7 @@ class LinkEvaluator(object):
Expand Down Expand Up @@ -201,7 +201,7 @@ index a74d78db..11128f4d 100644
if self._prefer_binary:
binary_preference = 1
- pri = -(wheel.support_index_min(valid_tags))
+ tags = self.valid_tags if not ignore_compatibility else None
+ tags = valid_tags
+ try:
+ pri = -(wheel.support_index_min(tags=tags))
+ except TypeError:
Expand Down

0 comments on commit 7059a26

Please sign in to comment.