Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix PackageFinder version sorting #683

Merged
merged 3 commits into from Sep 29, 2012
Merged

fix PackageFinder version sorting #683

merged 3 commits into from Sep 29, 2012

Conversation

qwcode
Copy link
Contributor

@qwcode qwcode commented Sep 23, 2012

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 existing found_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.

tests.test_finder.test_finder_detects_latest_already_satisfied_find_links
tests.test_upgrade.test_upgrade_with_newest_already_installed

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.

qwcode added a commit that referenced this pull request Sep 29, 2012
fix PackageFinder version sorting
@qwcode qwcode merged commit 134b5e3 into pypa:develop Sep 29, 2012
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant