Skip to content

Commit 55de77f

Browse files
committed
add length to progress bar
so progress bar shows real progress Signed-off-by: Miroslav Suchý <[email protected]>
1 parent 4ded913 commit 55de77f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.rst

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ v33.0.0 (next next, roadmap)
4242
- Update Dockerfile and test container build.
4343
See https://github.com/aboutcode-org/scancode-toolkit/issues/3955
4444

45+
- Progress bar now shows length. You can estimate the duration now.
46+
See https://github.com/aboutcode-org/scancode-toolkit/issues/3342
47+
4548
v32.3.2 - 2024-01-20
4649
--------------------
4750

src/scancode/cli.py

+4
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,8 @@ def scan_codebase(
12521252

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

12561258
use_threading = processes >= 0
12571259
runner = partial(
@@ -1287,6 +1289,8 @@ def scan_codebase(
12871289

12881290
if progress_manager:
12891291
scans = progress_manager(scans)
1292+
# times two because of #3344
1293+
scans.length = len(resources)*2
12901294
# hack to avoid using a context manager
12911295
if hasattr(scans, '__enter__'):
12921296
scans.__enter__()

0 commit comments

Comments
 (0)