From d407d7e889900d2f1e0cc652899668852201b755 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Fri, 13 Oct 2023 11:19:27 +0100 Subject: [PATCH] Only pass `--build-option` to `bdist_wheel` in build_meta In https://github.com/pypa/setuptools/issues/2491#issuecomment-1742859314 the discussion seems to lead to the idea that it is better for now to avoid passing any `--build-option` for commands that are not `bdist_wheel` in `setuptools.build_meta`. --- setuptools/build_meta.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/setuptools/build_meta.py b/setuptools/build_meta.py index 9267cf312f6..e8d28666392 100644 --- a/setuptools/build_meta.py +++ b/setuptools/build_meta.py @@ -318,7 +318,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(): @@ -406,6 +405,7 @@ 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], @@ -413,7 +413,6 @@ def _build_with_temp_dir( *setup_command, "--dist-dir", tmp_dist_dir, - *self._arbitrary_args(config_settings), ] with no_install_setup_requires(): self.run_setup() @@ -432,7 +431,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):