Skip to content

Commit

Permalink
fix(whl_library): avoid excessive report_progress() messages (#2280)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mattnworb authored Oct 8, 2024
1 parent 84ff577 commit ca0b27a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ A brief description of the categories of changes:
* (whl_filegroup): Provide per default also the `RECORD` file
* (py_wheel): `RECORD` file entry elements are now quoted if necessary when a
wheel is created
* (whl_library) truncate progress messages from the repo rule to better handle
case where a requirement has many `--hash=sha256:...` flags

### Added
* (py_wheel) Now supports `compress = (True|False)` to allow disabling
Expand Down
4 changes: 2 additions & 2 deletions examples/bzlmod/MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion python/private/pypi/whl_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ def _whl_library_impl(rctx):

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

0 comments on commit ca0b27a

Please sign in to comment.