summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2015-09-29 15:27:56 (GMT)
committerMichael Vogt <mvo@debian.org>2015-09-29 15:27:56 (GMT)
commit92f7e29f55bc0f4bf7bf9cc78730814700fb2284 (patch)
treef0d25e98be5983623da45b8f6c9eed637570ba10
parenta034a9eedc2a5e052415d584d3ed468938f811dc (diff)
Do not show pulse progress when the output is not a tty
This prevents download progress messages showing up in logfiles when python-apt is used for the downloading.
-rw-r--r--apt/progress/text.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/apt/progress/text.py b/apt/progress/text.py
index 04673de..05925d3 100644
--- a/apt/progress/text.py
+++ b/apt/progress/text.py
@@ -159,6 +159,11 @@ class AcquireProgress(base.AcquireProgress, TextProgress):
Return False if the user asked to cancel the whole Acquire process."""
base.AcquireProgress.pulse(self, owner)
+ # only show progress on a tty to not clutter log files etc
+ if hasattr(self._file, "fileno") and not os.isatty(self._file.fileno()):
+ return True
+
+ # calculate progress
percent = (((self.current_bytes + self.current_items) * 100.0) /
float(self.total_bytes + self.total_items))