Skip to content

Commit e2a3160

Browse files
committed
refactor: address review comments
Signed-off-by: Henry Schreiner <[email protected]>
1 parent bd583a2 commit e2a3160

File tree

3 files changed

+33
-19
lines changed

3 files changed

+33
-19
lines changed

cibuildwheel/frontend.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,19 @@ def options_summary(self) -> str | dict[str, str]:
3737

3838

3939
def _get_verbosity_flags(level: int, frontend: BuildFrontendName) -> list[str]:
40-
if frontend == "pip":
41-
if level > 0:
42-
return ["-" + level * "v"]
43-
if level < 0:
40+
if level < 0:
41+
if frontend == "pip":
4442
return ["-" + -level * "q"]
45-
elif level > 1:
46-
return ["-v"]
47-
elif level < 0:
43+
4844
msg = f"build_verbosity {level} is not supported for {frontend} frontend. Ignoring."
4945
log.warning(msg)
46+
47+
if level > 0:
48+
if frontend == "pip":
49+
return ["-" + level * "v"]
50+
if level > 1:
51+
return ["-" + (level - 1) * "v"]
52+
5053
return []
5154

5255

docs/options.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,14 +1762,25 @@ export CIBW_DEBUG_TRACEBACK=TRUE
17621762
### `CIBW_BUILD_VERBOSITY` {: #build-verbosity}
17631763
> Increase/decrease the output of the build
17641764
1765-
The setting vary a bit between build frontends.
1766-
1767-
* `-1`: Hide as much build output as possible; passes `-q` to the build frontend. Not supported by `build`/`build[uv]`.
1768-
* `0`: The default. On pip, this hides the build output if the build succeeds, other build frontends produce output from the build backend.
1769-
* `1`: Produces build backend output. On `pip`, this passes `-v`. Other frontends do this by default.
1770-
* `2`: Produces extra output from resolving packages too. On `pip`, this passes `-vv`, other build frontends use `-v`.
1771-
* `3`: Even more resolving output from pip with `-vvv`, other build frontends continue to just pass `-v`.
1772-
1765+
This setting controls `-v`/`-q` flags to the build frontend. Since there is
1766+
no communication between the build backend and the build frontend, build
1767+
messages from the build backend will always be shown with `1`; higher levels
1768+
will not produce more logging about the build itself. Other levels only affect
1769+
the build frontend output, which is usually things like resolving and
1770+
downloading dependencies. The settings are:
1771+
1772+
| | build | pip | desc |
1773+
|-------------|-------|--------|----------------------------------|
1774+
| -2 | N/A | `-qq` | even more quiet, where supported |
1775+
| -1 | N/A | `-q` | quiet mode, where supported |
1776+
| 0 (default) | | | default for build tool |
1777+
| 1 | | `-v` | print backend output |
1778+
| 2 | `-v` | `-vv` | print log messages e.g. resolving info |
1779+
| 3 | `-vv` | `-vvv` | print even more debug info |
1780+
1781+
Settings that are not supported for a specific frontend will log a warning.
1782+
The default build frontend is `build`, which does show build backend output by
1783+
default.
17731784

17741785
Platform-specific environment variables are also available:<br/>
17751786
`CIBW_BUILD_VERBOSITY_MACOS` | `CIBW_BUILD_VERBOSITY_WINDOWS` | `CIBW_BUILD_VERBOSITY_LINUX` | `CIBW_BUILD_VERBOSITY_IOS` | `CIBW_BUILD_VERBOSITY_PYODIDE`
@@ -1779,15 +1790,15 @@ Platform-specific environment variables are also available:<br/>
17791790
!!! tab examples "Environment variables"
17801791

17811792
```yaml
1782-
# Increase pip debugging output
1793+
# Ensure that the build backend output is present
17831794
CIBW_BUILD_VERBOSITY: 1
17841795
```
17851796

17861797
!!! tab examples "pyproject.toml"
17871798

17881799
```toml
17891800
[tool.cibuildwheel]
1790-
# Increase pip debugging output
1801+
# Ensure that the build backend output is present
17911802
build-verbosity = 1
17921803
```
17931804

unit_test/options_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,8 @@ def test_deprecated_image(
585585
("build", 0, ["-Ca", "-Cb", "-1"]),
586586
("build", 1, ["-Ca", "-Cb", "-1"]),
587587
("build", 2, ["-Ca", "-Cb", "-1", "-v"]),
588-
("build", 3, ["-Ca", "-Cb", "-1", "-v"]),
589-
("build[uv]", 3, ["-Ca", "-Cb", "-1", "-v"]),
588+
("build", 3, ["-Ca", "-Cb", "-1", "-vv"]),
589+
("build[uv]", 3, ["-Ca", "-Cb", "-1", "-vv"]),
590590
],
591591
)
592592
def test_get_build_frontend_extra_flags(

0 commit comments

Comments
 (0)