From 793064648698f9f069116d64f4537ea9cc2ab636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Such=C3=BD?= Date: Thu, 16 Jan 2025 11:49:53 +0100 Subject: [PATCH] add length to progress bar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit so progress bar shows real progress Signed-off-by: Miroslav Suchý --- CHANGELOG.rst | 3 +++ src/scancode/cli.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d115cda4b80..904dee3dbfb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -108,6 +108,9 @@ This is a patch release with bugfixes and improvements:: https://github.com/aboutcode-org/scancode-toolkit/pull/4476 +- Progress bar now shows length. You can estimate the duration now. + See https://github.com/aboutcode-org/scancode-toolkit/issues/3342 + v32.4.0 - 2025-06-26 -------------------- diff --git a/src/scancode/cli.py b/src/scancode/cli.py index 1376c6cfee9..fd8a9c6c53d 100644 --- a/src/scancode/cli.py +++ b/src/scancode/cli.py @@ -1264,6 +1264,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( @@ -1299,6 +1301,7 @@ def scan_codebase( if progress_manager: scans = progress_manager(scans) + scans.length = len(resources) # hack to avoid using a context manager if hasattr(scans, '__enter__'): scans.__enter__()