From 9921442d1f4df01e9c4f8300e5792037aba66809 Mon Sep 17 00:00:00 2001 From: Paul Moore Date: Wed, 27 Feb 2019 17:40:52 +0000 Subject: [PATCH 1/4] Reject --build-options for PEP 517 builds --- src/pip/_internal/wheel.py | 5 +++++ tests/functional/test_pep517.py | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/pip/_internal/wheel.py b/src/pip/_internal/wheel.py index 0b775430098..1bdbe93ab7e 100644 --- a/src/pip/_internal/wheel.py +++ b/src/pip/_internal/wheel.py @@ -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) diff --git a/tests/functional/test_pep517.py b/tests/functional/test_pep517.py index 6235a16e4d9..5b888855914 100644 --- a/tests/functional/test_pep517.py +++ b/tests/functional/test_pep517.py @@ -198,3 +198,16 @@ 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 From 1528d509029a93d9181fdcee978eef32295e5dda Mon Sep 17 00:00:00 2001 From: Paul Moore Date: Wed, 27 Feb 2019 17:50:42 +0000 Subject: [PATCH 2/4] Stupid typo --- tests/functional/test_pep517.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/test_pep517.py b/tests/functional/test_pep517.py index 5b888855914..7aa1de28512 100644 --- a/tests/functional/test_pep517.py +++ b/tests/functional/test_pep517.py @@ -203,7 +203,7 @@ 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 + 'wheel', '--wheel-dir', tmpdir, '--build-option', 'foo', '-f', common_wheels, project_dir, From 91ab257aa25693c4522c71e21c97305a5f0f6243 Mon Sep 17 00:00:00 2001 From: Paul Moore Date: Wed, 27 Feb 2019 17:53:23 +0000 Subject: [PATCH 3/4] Add a news fragment --- news/6305.feature | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 news/6305.feature diff --git a/news/6305.feature b/news/6305.feature new file mode 100644 index 00000000000..28637f1d5fc --- /dev/null +++ b/news/6305.feature @@ -0,0 +1,2 @@ +Using ``--build-options`` in a PEP 517 build now fails with an error, +rather than silently ignoring the option. From 8b7c23d05cbc7b2ae0aa2abdf9cf5625c90f4153 Mon Sep 17 00:00:00 2001 From: Paul Moore Date: Wed, 27 Feb 2019 18:04:50 +0000 Subject: [PATCH 4/4] Make flake8 shut up --- tests/functional/test_pep517.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/functional/test_pep517.py b/tests/functional/test_pep517.py index 7aa1de28512..51f96ed83b8 100644 --- a/tests/functional/test_pep517.py +++ b/tests/functional/test_pep517.py @@ -199,6 +199,7 @@ def test_explicit_setuptools_backend(script, tmpdir, data, common_wheels): ) 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)