Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reject --build-options for PEP 517 builds #6305

Merged
merged 4 commits into from
Feb 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions news/6305.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Using ``--build-options`` in a PEP 517 build now fails with an error,
rather than silently ignoring the option.
5 changes: 5 additions & 0 deletions src/pip/_internal/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,11 @@ def _build_one_pep517(self, req, tempd, python_tag=None):
Returns path to wheel if successfully built. Otherwise, returns None.
"""
assert req.metadata_directory is not None
if self.build_options:
# PEP 517 does not support --build-options
logger.error('Cannot build wheel for %s using PEP 517 when '
'--build-options is present' % (req.name,))
return None
try:
req.spin_message = 'Building wheel for %s (PEP 517)' % (req.name,)
logger.debug('Destination directory: %s', tempd)
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 @@ -198,3 +198,17 @@ def test_explicit_setuptools_backend(script, tmpdir, data, common_wheels):
project_dir,
)
result.assert_installed(name, editable=False)


def test_pep517_and_build_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,
'--build-option', 'foo',
'-f', common_wheels,
project_dir,
expect_error=True
)
assert 'Cannot build wheel' in result.stderr
assert 'when --build-options is present' in result.stderr