Skip to content

Commit

Permalink
add length to progress bar
Browse files Browse the repository at this point in the history
so progress bar shows real progress

Signed-off-by: Miroslav Suchý <[email protected]>
  • Loading branch information
xsuchy committed Jan 16, 2025
1 parent b0aff52 commit 284a453
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ v33.0.0 (next next, roadmap)
- Update Dockerfile and test container build.
See https://github.com/aboutcode-org/scancode-toolkit/issues/3955

- Progress bar now shows length. You can estimate the duration now.
See https://github.com/aboutcode-org/scancode-toolkit/issues/3342

v32.3.1 - 2024-01-06
--------------------

Expand Down
4 changes: 4 additions & 0 deletions src/scancode/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,8 @@ def scan_codebase(

# NOTE: we never scan directories
resources = ((r.location, r.path) for r in codebase.walk() if r.is_file)
if progress_manager:
resources = list(resources)

use_threading = processes >= 0
runner = partial(
Expand Down Expand Up @@ -1280,6 +1282,8 @@ def scan_codebase(

if progress_manager:
scans = progress_manager(scans)
# times two because of #3344
scans.length = len(resources)*2
# hack to avoid using a context manager
if hasattr(scans, '__enter__'):
scans.__enter__()
Expand Down

0 comments on commit 284a453

Please sign in to comment.