From 00fd0d55957db1d8844c8516d0f1db8409c41dcd Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Sat, 15 Nov 2025 18:42:34 +0300 Subject: [PATCH] add progress bar --- plugins/python-build/scripts/add_cpython.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/python-build/scripts/add_cpython.py b/plugins/python-build/scripts/add_cpython.py index be562e4f..1f939df0 100644 --- a/plugins/python-build/scripts/add_cpython.py +++ b/plugins/python-build/scripts/add_cpython.py @@ -24,6 +24,7 @@ import packaging.version import requests import requests_html import sortedcontainers +import tqdm logger = logging.getLogger(__name__) @@ -306,6 +307,7 @@ class Re: return result class Url: + logger = logging.getLogger("Url") @staticmethod def sha256_url(url, session=None): if session is None: @@ -313,8 +315,11 @@ class Url: logger.info(f"Downloading and computing hash of {url}") h=hashlib.sha256() r=session.get(url,stream=True) - for c in r.iter_content(None): - h.update(c) + total_bytes=int(r.headers.get('content-length',0)) or float('inf') + with tqdm.tqdm(total=total_bytes, unit='B', unit_scale=True, unit_divisor=1024) as t: + for c in r.iter_content(1024): + t.update(len(c)) + h.update(c) return h.hexdigest()