Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PackageFinder version sorting has only coincidentally been working due to the ordering of the various version lists prior to the sorting.
In the case where there were
file_versions
(when using file:// find-links), they were always sorting before existingfound_versions
with the same version, when it was supposed to be in reverse.The sort logic seemed to be originally intending to use the "Inf" object (in a multi-key sort) to cause existing installations to sort first when the version was the same, but wasn't actually using "Inf", and was only sorting by version alone.
You can recreate the problem by using these new tests (with the added simple-[23].0.tar.gz dists) against the old code.
In these changes, I tried to implement what I think was originally intended, w/o doing too much refactor (better to isolate refactor in dedicated pulls). The result is that the coincidental success should now be real success for any type of version tuple.
This change also corrected a bug where a certain block of code was never running before due to an incorrect index reference. In that block, is the possibility of raising
BestVersionAlreadyInstalled
for non-upgrades, but the install code is not written to handle that (and moreover it looks like this block may never actually be executed given our use of package finder). I removed the raise for now, and it just returns None.