From a07edd9ddc94b0cf2ac08119de2b763b49d55f75 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Sat, 18 Sep 2021 17:46:55 -0400 Subject: [PATCH] refactor: pull repr out of BuildOptions --- cibuildwheel/__main__.py | 3 +-- cibuildwheel/util.py | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cibuildwheel/__main__.py b/cibuildwheel/__main__.py index 22d3db5a..e0087485 100644 --- a/cibuildwheel/__main__.py +++ b/cibuildwheel/__main__.py @@ -406,8 +406,7 @@ def print_preamble(platform: str, build_options: BuildOptions) -> None: print("Build options:") print(f" platform: {platform!r}") - for option, value in sorted(build_options._asdict().items()): - print(f" {option}: {value!r}") + print(textwrap.indent(str(build_options), " ")) warnings = detect_warnings(platform, build_options) if warnings: diff --git a/cibuildwheel/util.py b/cibuildwheel/util.py index 3d9eb1be..5d536a93 100644 --- a/cibuildwheel/util.py +++ b/cibuildwheel/util.py @@ -225,6 +225,10 @@ class BuildOptions(NamedTuple): build_verbosity: int build_frontend: BuildFrontend + def __str__(self) -> str: + res = (f"{option}: {value!r}" for option, value in sorted(self._asdict().items())) + return "\n".join(res) + class NonPlatformWheelError(Exception): def __init__(self) -> None: