Skip to content

Commit

Permalink
PEP 517 build in presence of --global-option emits a warning
Browse files Browse the repository at this point in the history
So these are not ignored silently.
  • Loading branch information
sbidoul committed Apr 4, 2021
1 parent 69dee62 commit 7c6ee48
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion news/9774.feature.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Warn instead of erroring out when doing a PEP 517 build in presence of
``--build-option``.
``--build-option``. Warn when doing a PEP 517 build in presence of
``--global-option``.
4 changes: 4 additions & 0 deletions src/pip/_internal/wheel_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions tests/functional/test_pep517.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7c6ee48

Please sign in to comment.