From e4d291c5a7694760f7ef818d631f09add07c8ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Mon, 27 Mar 2023 13:52:23 +0200 Subject: 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. --- src/pip/_internal/cli/cmdoptions.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') 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 -- cgit v1.2.1