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

Append arbitrary args instead of prepending. #4217

Merged
merged 1 commit into from
Feb 23, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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>`.
11 changes: 9 additions & 2 deletions setuptools/build_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,12 @@ 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=(),
):
result_directory = os.path.abspath(result_directory)

Expand All @@ -384,6 +389,7 @@ def _build_with_temp_dir(
*setup_command,
"--dist-dir",
tmp_dist_dir,
*arbitrary_args,
]
with no_install_setup_requires():
self.run_setup()
Expand All @@ -402,10 +408,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,
self._arbitrary_args(config_settings),
)

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

def test_build_wheel_inplace(self, tmpdir_cwd):
config_settings = {"--build-option": ["build_ext", "--inplace"]}
path.build(self._simple_pyproject_example)
build_backend = self.get_build_backend()
assert not Path("build").exists()
Path("build").mkdir()
build_backend.prepare_metadata_for_build_wheel("build", config_settings)
build_backend.build_wheel("build", config_settings)
assert Path("build/proj-42-py3-none-any.whl").exists()

@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': {}})
Expand Down