Skip to content

Commit fe58a42

Browse files
committed
Warn when --install-option is ignored
Due to building with pep 517.
1 parent 77c8301 commit fe58a42

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

src/pip/_internal/req/req_install.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,15 @@ def _has_option(options: Values, reqs: List[InstallRequirement], option: str) ->
889889
return False
890890

891891

892+
def _install_option_ignored(
893+
install_options: List[str], reqs: List[InstallRequirement]
894+
) -> bool:
895+
for req in reqs:
896+
if (install_options or req.install_options) and not req.use_pep517:
897+
return False
898+
return True
899+
900+
892901
class LegacySetupPyOptionsCheckMode(Enum):
893902
INSTALL = 1
894903
WHEEL = 2
@@ -916,13 +925,18 @@ def check_legacy_setup_py_options(
916925
"Consider using --config-settings for more flexibility.",
917926
)
918927
if mode == LegacySetupPyOptionsCheckMode.INSTALL and has_install_options:
919-
deprecated(
920-
reason=(
921-
"--install-option is deprecated because "
922-
"it forces pip to use the 'setup.py install' "
923-
"command which is itself deprecated."
924-
),
925-
issue=11358,
926-
replacement="to use --config-settings",
927-
gone_in="23.1",
928-
)
928+
if _install_option_ignored(options.install_options, reqs):
929+
logger.warning(
930+
"Ignoring --install-option when building using PEP 517",
931+
)
932+
else:
933+
deprecated(
934+
reason=(
935+
"--install-option is deprecated because "
936+
"it forces pip to use the 'setup.py install' "
937+
"command which is itself deprecated."
938+
),
939+
issue=11358,
940+
replacement="to use --config-settings",
941+
gone_in="23.1",
942+
)

0 commit comments

Comments
 (0)