summaryrefslogtreecommitdiff
path: root/src/pip/_internal/cli/cmdoptions.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/pip/_internal/cli/cmdoptions.py')
-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