From fab96c636d57d960d8e4a9f18429dc0361b7c8db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 4 Apr 2021 14:39:24 +0200 Subject: [PATCH] PEP 517 build in presence of --global-option emits a warning So these are not ignored silently. --- src/pip/_internal/wheel_builder.py | 4 ++++ tests/functional/test_pep517.py | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/pip/_internal/wheel_builder.py b/src/pip/_internal/wheel_builder.py index c2cbf1eebb7..92f172bca16 100644 --- a/src/pip/_internal/wheel_builder.py +++ b/src/pip/_internal/wheel_builder.py @@ -244,6 +244,10 @@ def _build_one_inside_env( if req.use_pep517: assert req.metadata_directory assert req.pep517_backend + if global_options: + logger.warning( + 'Ignoring --global-option when building %s using PEP 517', req.name + ) if build_options: logger.warning( 'Ignoring --build-option when building %s using PEP 517', req.name diff --git a/tests/functional/test_pep517.py b/tests/functional/test_pep517.py index ae747d9fda1..4458a7ad56e 100644 --- a/tests/functional/test_pep517.py +++ b/tests/functional/test_pep517.py @@ -266,3 +266,17 @@ def test_pep517_and_build_options(script, tmpdir, data, common_wheels): ) assert 'Ignoring --build-option when building' in result.stderr assert 'using PEP 517' in result.stderr + + +@pytest.mark.network +def test_pep517_and_global_options(script, tmpdir, data, common_wheels): + """Backend generated requirements are installed in the build env""" + project_dir, name = make_pyproject_with_setup(tmpdir) + result = script.pip( + 'wheel', '--wheel-dir', tmpdir, + '--global-option', 'foo', + '-f', common_wheels, + project_dir, + ) + assert 'Ignoring --global-option when building' in result.stderr + assert 'using PEP 517' in result.stderr