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

cmdoptions: Check if format_control exists before accessing it #9459

Closed
wants to merge 2 commits into from

Conversation

NoahGorny
Copy link
Contributor

Fixes a case when per-setup.py options are specified in a requirement
file, and we are trying to invoke uninstall
Closes #9444

@sbidoul
Copy link
Member

sbidoul commented Jan 17, 2021

@NoahGorny thanks! Could you add a test that surfaces the issue ? This will help make sure this does not crop up again when this part will be refactored.

@NoahGorny
Copy link
Contributor Author

@NoahGorny thanks! Could you add a test that surfaces the issue ? This will help make sure this does not crop up again when this part will be refactored.

@sbidoul Done 😄

Comment on lines 1 to 3
Check if format_control exists before accessing it.
Fixes a case when per-setup.py options are specified in a requirement
file, and we are trying to invoke uninstall.
Copy link
Member

@pradyunsg pradyunsg Mar 6, 2021

Choose a reason for hiding this comment

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

Suggested change
Check if format_control exists before accessing it.
Fixes a case when per-setup.py options are specified in a requirement
file, and we are trying to invoke uninstall.
Permit ``pip uninstall -r`` to accept requirements files containing ``--install-option`` or ``--global-option``.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done 😄

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.

Seems good to me!

@pradyunsg
Copy link
Member

Oh, please do rebase this PR on the current master branch, since there have been quite a few linter-related changes and I'd appreciate to get a confirmation that this won't break CI once merged. :)

@NoahGorny
Copy link
Contributor Author

Oh, please do rebase this PR on the current master branch, since there have been quite a few linter-related changes and I'd appreciate to get a confirmation that this won't break CI once merged. :)

hey @pradyunsg , I did what you requested, let me know what you think 😄

if any(map(getname, names)):
control = options.format_control

control = getattr(options, "format_control", None)
Copy link
Member

Choose a reason for hiding this comment

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

Why is format_control not present on the options object? Is there a way we can make it always available instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am unsure, as this approach is the one being used with the build/global/install_options

Noah Gorny added 2 commits September 16, 2021 23:03
Fixes a case when per-setup.py options are specified in a requirement
file, and we are trying to invoke uninstall
@github-actions github-actions bot added the needs rebase or merge PR has conflicts with current master label Nov 19, 2021
@pradyunsg
Copy link
Member

Going to go ahead and close this, since it has merge conflicts that haven't been resolved in a while. Please feel welcome to file a new PR or to reopen and update this one!

FWIW, --install-options is going to go away in a future release: #11358

@pradyunsg pradyunsg closed this Sep 30, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs rebase or merge PR has conflicts with current master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pip uninstall -r requirements throws an exception if the requirements file contains --install-option
4 participants