fix: show options for --only (#2499)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
@@ -26,6 +26,7 @@ from cibuildwheel.selector import BuildSelector, EnableGroup, selector_matches
|
|||||||
from cibuildwheel.typing import PLATFORMS, PlatformName
|
from cibuildwheel.typing import PLATFORMS, PlatformName
|
||||||
from cibuildwheel.util.file import CIBW_CACHE_PATH
|
from cibuildwheel.util.file import CIBW_CACHE_PATH
|
||||||
from cibuildwheel.util.helpers import strtobool
|
from cibuildwheel.util.helpers import strtobool
|
||||||
|
from cibuildwheel.util.resources import read_all_configs
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass
|
@dataclasses.dataclass
|
||||||
@@ -132,6 +133,8 @@ def main_inner(global_options: GlobalOptions) -> None:
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--only",
|
"--only",
|
||||||
default=None,
|
default=None,
|
||||||
|
choices=[v["identifier"] for vv in read_all_configs().values() for v in vv],
|
||||||
|
metavar="IDENTIFIER",
|
||||||
help="""
|
help="""
|
||||||
Force a single wheel build when given an identifier. Overrides
|
Force a single wheel build when given an identifier. Overrides
|
||||||
CIBW_BUILD/CIBW_SKIP. --platform and --arch cannot be specified
|
CIBW_BUILD/CIBW_SKIP. --platform and --arch cannot be specified
|
||||||
|
|||||||
@@ -22,8 +22,11 @@ TEST_FAIL_CWD_FILE: Final[Path] = PATH / "testing_temp_dir_file.py"
|
|||||||
|
|
||||||
# this value is cached because it's used a lot in unit tests
|
# this value is cached because it's used a lot in unit tests
|
||||||
@functools.cache
|
@functools.cache
|
||||||
def read_python_configs(config: PlatformName) -> list[dict[str, str]]:
|
def read_all_configs() -> dict[str, list[dict[str, str]]]:
|
||||||
with BUILD_PLATFORMS.open("rb") as f:
|
with BUILD_PLATFORMS.open("rb") as f:
|
||||||
loaded_file = tomllib.load(f)
|
loaded_file = tomllib.load(f)
|
||||||
results: list[dict[str, str]] = list(loaded_file[config]["python_configurations"])
|
return {k: list[dict[str, str]](v["python_configurations"]) for k, v in loaded_file.items()}
|
||||||
return results
|
|
||||||
|
|
||||||
|
def read_python_configs(config: PlatformName) -> list[dict[str, str]]:
|
||||||
|
return read_all_configs()[config]
|
||||||
|
|||||||
Reference in New Issue
Block a user