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

DO NOT sort the returned matches by version #8319

Merged

Conversation

uranusjr
Copy link
Member

Bug found by the unit test introduced in #7996.

A higher version is not always preferred over the lower; the user may be explicitly preferring lower versions by specifying --prefer-binary or similar flags.

PackageFinder already takes these into account and orders the matches. Don't break it.

A higher version is not always preferred over the lower; the user may
be explicitly preferring lower versions by specifying --prefer-binary
or similar flags.

PackageFinder already takes these into account for these and orders
the matches. Don't break it.
Comment on lines 104 to +106
if c.is_installed and not _eligible_for_upgrade(c.name):
return (1, c.version)

return (0, c.version)
return 1
return 0
Copy link
Member

@pradyunsg pradyunsg May 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

	return int(c.is_installed and not _eligible_for_upgrade(c.name))

puppy face

Copy link
Member

@pradyunsg pradyunsg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm nit-picking, but this change LGTM.

@uranusjr
Copy link
Member Author

uranusjr commented May 25, 2020

This is likely also the fix to the currently xfail-ed test_download_prefer_binary_when_tarball_higher_than_wheel, which is testing --prefer-binary, from the command line. The test from #7996 tests the same option in requirements.txt).

@pradyunsg
Copy link
Member

I'm gonna go ahead and merge this without Paul's green tick since... I'm pretty certain that this change is good to go. (please holler if I'm wrong Paul!)

@pradyunsg pradyunsg merged commit 1ebeab5 into pypa:master May 25, 2020
@pfmoore
Copy link
Member

pfmoore commented May 25, 2020

Fine with me, I've been mostly offline all day (public holiday in the UK, plus attempting to take some time away from a PC screen).

@uranusjr uranusjr deleted the fix-prefer-binary-reqfile-new-resolver branch May 25, 2020 19:57
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
skip news Does not need a NEWS file entry (eg: trivial changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants