From 2e48667e29fa128d96738dd6bb585aaab232b580 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 10 Mar 2023 13:46:42 -0500 Subject: [PATCH] refactor: use frontend instead of plural Signed-off-by: Henry Schreiner --- cibuildwheel/linux.py | 2 +- cibuildwheel/macos.py | 2 +- cibuildwheel/util.py | 4 ++-- cibuildwheel/windows.py | 2 +- unit_test/main_tests/main_options_test.py | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cibuildwheel/linux.py b/cibuildwheel/linux.py index 5cc19bf55..f5d8710e1 100644 --- a/cibuildwheel/linux.py +++ b/cibuildwheel/linux.py @@ -241,7 +241,7 @@ def build_in_container( verbosity_flags = get_build_verbosity_extra_flags(build_options.build_verbosity) extra_flags = split_config_settings( - build_options.config_settings, plural=build_options.build_frontend == "pip" + build_options.config_settings, build_options.build_frontend ) if build_options.build_frontend == "pip": diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index 49068ab89..3bb1324db 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -375,7 +375,7 @@ def build(options: Options, tmp_path: Path) -> None: verbosity_flags = get_build_verbosity_extra_flags(build_options.build_verbosity) extra_flags = split_config_settings( - build_options.config_settings, plural=build_options.build_frontend == "pip" + build_options.config_settings, build_options.build_frontend ) if build_options.build_frontend == "pip": diff --git a/cibuildwheel/util.py b/cibuildwheel/util.py index f217af081..72cff3260 100644 --- a/cibuildwheel/util.py +++ b/cibuildwheel/util.py @@ -208,9 +208,9 @@ def get_build_verbosity_extra_flags(level: int) -> list[str]: return [] -def split_config_settings(config_settings: str, *, plural: bool) -> list[str]: +def split_config_settings(config_settings: str, frontend: Literal["pip", "build"]) -> list[str]: config_settings_list = shlex.split(config_settings) - s = "s" if plural else "" + s = "s" if frontend == "pip" else "" return [f"--config-setting{s}={setting}" for setting in config_settings_list] diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index 3eeee294d..cb83a324b 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -412,7 +412,7 @@ def build(options: Options, tmp_path: Path) -> None: verbosity_flags = get_build_verbosity_extra_flags(build_options.build_verbosity) extra_flags = split_config_settings( - build_options.config_settings, plural=build_options.build_frontend == "pip" + build_options.config_settings, build_options.build_frontend ) if build_options.build_frontend == "pip": diff --git a/unit_test/main_tests/main_options_test.py b/unit_test/main_tests/main_options_test.py index ec9b0725d..6cda8967b 100644 --- a/unit_test/main_tests/main_options_test.py +++ b/unit_test/main_tests/main_options_test.py @@ -283,13 +283,13 @@ def test_config_settings(platform_specific, platform, intercepted_build_args, mo assert build_options.config_settings == config_settings - assert split_config_settings(config_settings, plural=False) == [ + 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, plural=True) == [ + assert split_config_settings(config_settings, "pip") == [ "--config-settings=setting=value", "--config-settings=setting=value2", "--config-settings=other=something else",