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

fix: pip config options were broken #1430

Merged
merged 2 commits into from
Mar 11, 2023
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
4 changes: 3 additions & 1 deletion cibuildwheel/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@ def build_in_container(
container.call(["mkdir", "-p", built_wheel_dir])

verbosity_flags = get_build_verbosity_extra_flags(build_options.build_verbosity)
extra_flags = split_config_settings(build_options.config_settings)
extra_flags = split_config_settings(
build_options.config_settings, build_options.build_frontend
)

if build_options.build_frontend == "pip":
extra_flags += verbosity_flags
Expand Down
4 changes: 3 additions & 1 deletion cibuildwheel/macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,9 @@ def build(options: Options, tmp_path: Path) -> None:
built_wheel_dir.mkdir()

verbosity_flags = get_build_verbosity_extra_flags(build_options.build_verbosity)
extra_flags = split_config_settings(build_options.config_settings)
extra_flags = split_config_settings(
build_options.config_settings, build_options.build_frontend
)

if build_options.build_frontend == "pip":
extra_flags += verbosity_flags
Expand Down
5 changes: 3 additions & 2 deletions cibuildwheel/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,10 @@ def get_build_verbosity_extra_flags(level: int) -> list[str]:
return []


def split_config_settings(config_settings: str) -> list[str]:
def split_config_settings(config_settings: str, frontend: Literal["pip", "build"]) -> list[str]:
config_settings_list = shlex.split(config_settings)
return [f"--config-setting={setting}" for setting in config_settings_list]
s = "s" if frontend == "pip" else ""
return [f"--config-setting{s}={setting}" for setting in config_settings_list]


def read_python_configs(config: PlatformName) -> list[dict[str, str]]:
Expand Down
4 changes: 3 additions & 1 deletion cibuildwheel/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,9 @@ def build(options: Options, tmp_path: Path) -> None:
built_wheel_dir.mkdir()

verbosity_flags = get_build_verbosity_extra_flags(build_options.build_verbosity)
extra_flags = split_config_settings(build_options.config_settings)
extra_flags = split_config_settings(
build_options.config_settings, build_options.build_frontend
)

if build_options.build_frontend == "pip":
extra_flags += verbosity_flags
Expand Down
8 changes: 7 additions & 1 deletion unit_test/main_tests/main_options_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,18 @@ def test_config_settings(platform_specific, platform, intercepted_build_args, mo

assert build_options.config_settings == config_settings

assert split_config_settings(config_settings) == [
assert split_config_settings(config_settings, "build") == [
"--config-setting=setting=value",
"--config-setting=setting=value2",
"--config-setting=other=something else",
]

assert split_config_settings(config_settings, "pip") == [
"--config-settings=setting=value",
"--config-settings=setting=value2",
"--config-settings=other=something else",
]


@pytest.mark.parametrize(
"selector",
Expand Down