Skip to content

Commit

Permalink
Append arbitrary args instead of prepending.
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshilliard committed Feb 21, 2024
1 parent 569fd7b commit 91f3400
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions newsfragments/4217.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix argument order of ``--config-settings["--build-option"]`` arguments.
This was broken by <https://github.com/pypa/setuptools/pull/4079>`.
7 changes: 5 additions & 2 deletions setuptools/build_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def prepare_metadata_for_build_wheel(
return self._bubble_up_info_directory(metadata_directory, ".dist-info")

def _build_with_temp_dir(
self, setup_command, result_extension, result_directory, config_settings
self, setup_command, result_extension, result_directory, config_settings, arbitrary_args=False
):
result_directory = os.path.abspath(result_directory)

Expand All @@ -385,6 +385,8 @@ def _build_with_temp_dir(
"--dist-dir",
tmp_dist_dir,
]
if arbitrary_args:
sys.argv += self._arbitrary_args(config_settings)
with no_install_setup_requires():
self.run_setup()

Expand All @@ -402,10 +404,11 @@ def build_wheel(
):
with suppress_known_deprecation():
return self._build_with_temp_dir(
['bdist_wheel', *self._arbitrary_args(config_settings)],
['bdist_wheel'],
'.whl',
wheel_directory,
config_settings,
True,
)

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

@pytest.mark.parametrize("config_settings", [{"editable-mode": "strict"}])
@pytest.mark.parametrize(
"config_settings",
[
{"--build-option": ["build_ext", "--inplace"]},
{"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 91f3400

Please sign in to comment.