feat: support config-settings (#1244)

* feat: support config-settings

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

feat: support config-settings

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* refactor: use shlex.quote

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
Henry Schreiner
2022-09-06 00:56:20 -04:00
committed by GitHub
parent 6a9b39af49
commit 3597095948
10 changed files with 170 additions and 16 deletions
+35
View File
@@ -331,3 +331,38 @@ test-command = "pyproject-override"
with pytest.raises(ConfigOptionError):
OptionsReader(config_file_path=pyproject_toml, platform=platform)
def test_config_settings(tmp_path):
pyproject_toml: Path = tmp_path / "pyproject.toml"
pyproject_toml.write_text(
"""\
[tool.cibuildwheel.config-settings]
example = "one"
other = ["two", "three"]
"""
)
options_reader = OptionsReader(config_file_path=pyproject_toml, platform="linux")
assert (
options_reader.get("config-settings", table={"item": '{k}="{v}"', "sep": " "})
== 'example="one" other="two" other="three"'
)
def test_pip_config_settings(tmp_path):
pyproject_toml: Path = tmp_path / "pyproject.toml"
pyproject_toml.write_text(
"""\
[tool.cibuildwheel.config-settings]
--build-option="--use-mypyc"
"""
)
options_reader = OptionsReader(config_file_path=pyproject_toml, platform="linux")
assert (
options_reader.get(
"config-settings", table={"item": "--config-settings='{k}=\"{v}\"'", "sep": " "}
)
== "--config-settings='--build-option=\"--use-mypyc\"'"
)