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

Conversation

Projects
None yet
1 participant
@qwcode
Contributor

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

Merge pull request #683 from qwcode/link_sort
fix PackageFinder version sorting

@qwcode qwcode merged commit 134b5e3 into pypa:develop Sep 29, 2012

1 check passed

default The Travis build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment