Skip to content

Commit ca0b27a

Browse files
authored
fix(whl_library): avoid excessive report_progress() messages (#2280)
With the current behavior, we see really long progress messages in the console like ``` Running whl_library.ResolveRequirement(foobar_pip_deps_regex, regex==2023.12.25 --hash=sha256:0694219a1d54336fd0445ea3\ 82d49d36882415c0134ee1e8332afd1529f0baa5 <many more lines of --hash values> ``` This spams the console and isn't very useful. To fix, only print up to the first white space, which captures the important information (e.g. "regex==2024.12.25") and is brief. Closes #2206
1 parent 84ff577 commit ca0b27a

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ A brief description of the categories of changes:
4242
* (whl_filegroup): Provide per default also the `RECORD` file
4343
* (py_wheel): `RECORD` file entry elements are now quoted if necessary when a
4444
wheel is created
45+
* (whl_library) truncate progress messages from the repo rule to better handle
46+
case where a requirement has many `--hash=sha256:...` flags
4547

4648
### Added
4749
* (py_wheel) Now supports `compress = (True|False)` to allow disabling

examples/bzlmod/MODULE.bazel.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/private/pypi/whl_library.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ def _whl_library_impl(rctx):
244244

245245
repo_utils.execute_checked(
246246
rctx,
247-
op = op_tmpl.format(name = rctx.attr.name, requirement = rctx.attr.requirement),
247+
# truncate the requirement value when logging it / reporting
248+
# progress since it may contain several ' --hash=sha256:...
249+
# --hash=sha256:...' substrings that fill up the console
250+
op = op_tmpl.format(name = rctx.attr.name, requirement = rctx.attr.requirement.split(" ", 1)[0]),
248251
arguments = args,
249252
environment = environment,
250253
quiet = rctx.attr.quiet,

0 commit comments

Comments
 (0)