summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStéphane Bidoul <stephane.bidoul@gmail.com>2023-03-27 13:52:23 +0200
committerStéphane Bidoul <stephane.bidoul@gmail.com>2023-03-27 13:52:23 +0200
commite4d291c5a7694760f7ef818d631f09add07c8ad5 (patch)
treed0fbce7899804bb3a04b9fb196b0970692e8b6c3 /src
parent8f52335ae58d694b459807d83f08613a9ac8eb51 (diff)
downloadpip-e4d291c5a7694760f7ef818d631f09add07c8ad5.tar.gz
Combine setuptools and wheel detection in one step
It would be annoying if you see an error about setuptools, install it, and only be greeted by another error telling you to install wheel. So we combine the two into one.
Diffstat (limited to 'src')
-rw-r--r--src/pip/_internal/cli/cmdoptions.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/pip/_internal/cli/cmdoptions.py b/src/pip/_internal/cli/cmdoptions.py
index 3d78013a9..c27ba1c6a 100644
--- a/src/pip/_internal/cli/cmdoptions.py
+++ b/src/pip/_internal/cli/cmdoptions.py
@@ -785,13 +785,13 @@ def _handle_no_use_pep517(
# If user doesn't wish to use pep517, we check if setuptools and wheel are installed
# and raise error if it is not.
- for package in ("setuptools", "wheel"):
- if not importlib.util.find_spec(package):
- msg = (
- f"It is not possible to use --no-use-pep517 "
- f"without {package} installed."
- )
- raise_option_error(parser, option=option, msg=msg)
+ packages = ("setuptools", "wheel")
+ if not all(importlib.util.find_spec(package) for package in packages):
+ msg = (
+ f"It is not possible to use --no-use-pep517 "
+ f"without {' and '.join(packages)} installed."
+ )
+ raise_option_error(parser, option=option, msg=msg)
# Otherwise, --no-use-pep517 was passed via the command-line.
parser.values.use_pep517 = False