Skip to content

bpo-31351: Fix RC 0 in ensurepip when pip fails #3626

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

Merged
merged 3 commits into from
Sep 21, 2017

Conversation

iafilatov
Copy link
Contributor

@iafilatov iafilatov commented Sep 17, 2017

ensurepip discards pip's return code which leads to broken venvs. Make sure EC is propagated to that scripts that run ensurepip in a separate process (e.g. python -m ensurepip) can detect failure.

I decided to keep the return value of the public version of bootstrap() unmodified although I'm not sure it's correct because it leaves no way to check if pip has succeeded or not (and I doubt there's a lot of code that relies on bootstrap() returning None).

https://bugs.python.org/issue31351

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

Copy link
Contributor

@ncoghlan ncoghlan left a comment

Choose a reason for hiding this comment

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

This looks good to me. Just one additional change needed, which is to mention the command line return value with a corresponding .. versionchanged: 3.7.0 note in https://docs.python.org/3/library/ensurepip.html#command-line-interface

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I didn't expect the Spanish Inquisition!. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@ncoghlan
Copy link
Contributor

As far as the return value of ensurepip.bootstrap() goes, I agree it makes sense to pursue the command-line-only fix first, and then consider changing the Python API in a follow-up patch (since we may decide we want to indicate bootstrap errors with an exception instead of a return value)

@iafilatov
Copy link
Contributor Author

I didn't expect the Spanish Inquisition!

@bedevere-bot
Copy link

Nobody expects the Spanish Inquisition!

@ncoghlan: please review the changes made to this pull request.

@ncoghlan ncoghlan merged commit 9adda0c into python:master Sep 21, 2017
@miss-islington
Copy link
Contributor

Thanks @iafilatov for the PR, and @ncoghlan for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-3683 is a backport of this pull request to the 3.6 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 21, 2017
…H-3626)

Previously ensurepip would always report success, even if the
pip installation failed.
(cherry picked from commit 9adda0c)
Mariatta pushed a commit that referenced this pull request Sep 22, 2017
…3683)

Previously ensurepip would always report success, even if the
pip installation failed.
(cherry picked from commit 9adda0c)

* Update version changed notice for backport
@iafilatov iafilatov deleted the issue-31351-ensurepip-rc branch September 22, 2017 13:49
@miss-islington
Copy link
Contributor

Thanks @iafilatov for the PR, and @ncoghlan for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @iafilatov and @ncoghlan, I could not cleanly backport this to 2.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 9adda0cdf89432386b7a04444a6199b580d287a1 2.7

iafilatov added a commit to iafilatov/cpython that referenced this pull request Sep 24, 2017
…H-3626)

Previously ensurepip would always report success, even if the
pip installation failed..
(cherry picked from commit 9adda0c)
@bedevere-bot
Copy link

GH-3734 is a backport of this pull request to the 2.7 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants