Skip to content

Commit

Permalink
Only pass --build-option to bdist_wheel in build_meta (#4079)
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Nov 20, 2023
2 parents 30b8a88 + b599a45 commit 3aec9c6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 4 additions & 0 deletions newsfragments/4079.removal.rst
@@ -0,0 +1,4 @@
Removed handling of ``--config-settings["--build-option"]`` in ``setuptools.build_meta``
from build-backend API hooks *other than* ``build_wheel``.
This was motivate by `errors caused when passing this option
<https://github.com/pypa/setuptools/issues/2491#issuecomment-1742859314>`_.
8 changes: 5 additions & 3 deletions setuptools/build_meta.py
Expand Up @@ -289,7 +289,6 @@ def _get_build_requires(self, config_settings, requirements):
*sys.argv[:1],
*self._global_args(config_settings),
"egg_info",
*self._arbitrary_args(config_settings),
]
try:
with Distribution.patch():
Expand Down Expand Up @@ -377,14 +376,14 @@ def _build_with_temp_dir(
# Build in a temporary directory, then copy to the target.
os.makedirs(result_directory, exist_ok=True)
temp_opts = {"prefix": ".tmp-", "dir": result_directory}

with tempfile.TemporaryDirectory(**temp_opts) as tmp_dist_dir:
sys.argv = [
*sys.argv[:1],
*self._global_args(config_settings),
*setup_command,
"--dist-dir",
tmp_dist_dir,
*self._arbitrary_args(config_settings),
]
with no_install_setup_requires():
self.run_setup()
Expand All @@ -403,7 +402,10 @@ def build_wheel(
):
with suppress_known_deprecation():
return self._build_with_temp_dir(
['bdist_wheel'], '.whl', wheel_directory, config_settings
['bdist_wheel', *self._arbitrary_args(config_settings)],
'.whl',
wheel_directory,
config_settings,
)

def build_sdist(self, sdist_directory, config_settings=None):
Expand Down
8 changes: 1 addition & 7 deletions setuptools/tests/test_build_meta.py
Expand Up @@ -720,13 +720,7 @@ def test_editable_without_config_settings(self, tmpdir_cwd):
build_backend.build_editable("temp")
assert not Path("build").exists()

@pytest.mark.parametrize(
"config_settings",
[
{"--build-option": ["--mode", "strict"]},
{"editable-mode": "strict"},
],
)
@pytest.mark.parametrize("config_settings", [{"editable-mode": "strict"}])
def test_editable_with_config_settings(self, tmpdir_cwd, config_settings):
path.build({**self._simple_pyproject_example, '_meta': {}})
assert not Path("build").exists()
Expand Down

0 comments on commit 3aec9c6

Please sign in to comment.