From 9b41e0c98f0624de14ca001a407a7cb2b46f1710 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 29 Mar 2016 21:08:02 +0530 Subject: [PATCH] Reduce number of Downloading prints when the installer output is redirected to a file --- setup/linux-installer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup/linux-installer.py b/setup/linux-installer.py index 8fbc30a0cc..be651b0074 100644 --- a/setup/linux-installer.py +++ b/setup/linux-installer.py @@ -228,11 +228,14 @@ class Reporter: # {{{ except ValueError: prints('Downloading', fname) self.pb = None + self.last_percent = 0 def __call__(self, blocks, block_size, total_size): percent = (blocks*block_size)/float(total_size) if self.pb is None: - prints('Downloaded {0:%}'.format(percent)) + if percent - self.last_percent > 0.05: + self.last_percent = percent + prints('Downloaded {0:%}'.format(percent)) else: try: self.pb.update(percent)