Skip to content

Commit

Permalink
cmdoptions: Check if format_control exists before accessing it
Browse files Browse the repository at this point in the history
Fixes a case when per-setup.py options are specified in a requirement
file, and we are trying to invoke uninstall
  • Loading branch information
Noah Gorny committed Mar 7, 2021
1 parent d9d7790 commit a81b83f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/9444.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Permit ``pip uninstall -r`` to accept requirements files containing ``--install-option`` or ``--global-option``.
5 changes: 3 additions & 2 deletions src/pip/_internal/cli/cmdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ def getname(n):
return getattr(check_options, n, None)

names = ["build_options", "global_options", "install_options"]
if any(map(getname, names)):
control = options.format_control

control = getattr(options, "format_control", None)
if control and any(map(getname, names)):
control.disallow_binaries()
warnings.warn(
"Disabling all use of wheels due to the use of --build-option "
Expand Down

0 comments on commit a81b83f

Please sign in to comment.