diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2023-05-24 11:41:20 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-05-25 11:06:09 -0400 |
commit | 11521c6db7facf0703a6037948fdcc1f69cd6246 (patch) | |
tree | 7932f53483ac8999157b074767ca7e3a0781e5b5 /mesonbuild/wrap | |
parent | 2c806099c7d581b4181acd3ecffac42bed223bea (diff) | |
download | meson-11521c6db7facf0703a6037948fdcc1f69cd6246.zip meson-11521c6db7facf0703a6037948fdcc1f69cd6246.tar.gz meson-11521c6db7facf0703a6037948fdcc1f69cd6246.tar.bz2 |
ProgressBar: Fix some rendering issues
- Do not hardcode terminal width of 100 chars, that breaks rendering on
smaller terminal. It already uses current console width by default.
- Disable progress bar when downloading from msubprojects because it
fetches multiple wraps in parallel.
- Scale unit when downloading e.g. MB/s.
- Do not display rate when it's not a download.
- Do not display time elapsed to simplify the rendering.
Diffstat (limited to 'mesonbuild/wrap')
-rw-r--r-- | mesonbuild/wrap/wrap.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 06335ce..9e423ea 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -285,6 +285,7 @@ class Resolver: wrap_mode: WrapMode = WrapMode.default wrap_frontend: bool = False allow_insecure: bool = False + silent: bool = False def __post_init__(self) -> None: self.subdir_root = os.path.join(self.source_dir, self.subdir) @@ -695,7 +696,8 @@ class Resolver: return hashvalue, tmpfile.name sys.stdout.flush() progress_bar = ProgressBar(bar_type='download', total=dlsize, - desc='Downloading') + desc='Downloading', + disable=(self.silent or None)) while True: block = resp.read(blocksize) if block == b'': |