Skip to content

Commit 284a453

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

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
@@ -38,6 +38,9 @@ v33.0.0 (next next, roadmap)
3838
- Update Dockerfile and test container build.
3939
See https://github.com/aboutcode-org/scancode-toolkit/issues/3955
4040

41+
- Progress bar now shows length. You can estimate the duration now.
42+
See https://github.com/aboutcode-org/scancode-toolkit/issues/3342
43+
4144
v32.3.1 - 2024-01-06
4245
--------------------
4346

src/scancode/cli.py

+4
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,8 @@ def scan_codebase(
12451245

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

12491251
use_threading = processes >= 0
12501252
runner = partial(
@@ -1280,6 +1282,8 @@ def scan_codebase(
12801282

12811283
if progress_manager:
12821284
scans = progress_manager(scans)
1285+
# times two because of #3344
1286+
scans.length = len(resources)*2
12831287
# hack to avoid using a context manager
12841288
if hasattr(scans, '__enter__'):
12851289
scans.__enter__()

0 commit comments

Comments
 (0)