summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2019-05-24 14:06:47 +0100
committerJonathan Maw <jonathan.maw@codethink.co.uk>2019-05-24 14:42:27 +0100
commit9d3ef2f94fcfe939e2069fa98305b0c3debd7fea (patch)
treec092e804907ccb01890de9fbc54df07c73fadbca
parent51f612acb5bb4c7e42f07c0569695d6dd3661c1f (diff)
downloadbuildstream-9d3ef2f94fcfe939e2069fa98305b0c3debd7fea.tar.gz
Make progress-reporting not print a new line for every update
-rw-r--r--src/buildstream/_context.py14
-rw-r--r--src/buildstream/_progress.py2
2 files changed, 12 insertions, 4 deletions
diff --git a/src/buildstream/_context.py b/src/buildstream/_context.py
index f01df7a4a..8345ec195 100644
--- a/src/buildstream/_context.py
+++ b/src/buildstream/_context.py
@@ -18,6 +18,7 @@
# Tristan Van Berkom <tristan.vanberkom@codethink.co.uk>
import os
+import sys
import shutil
import datetime
from collections import deque
@@ -169,6 +170,7 @@ class Context():
self._cascache = None
self._casquota = None
self._directory = directory
+ self._last_progress_length = 0
# load()
#
@@ -560,12 +562,20 @@ class Context():
detail=None, silent_nested=False):
with self.timed_activity(activity_name, unique_id=unique_id,
detail=detail, silent_nested=silent_nested):
+ self._last_progress_length = 0
progress = Progress(self, activity_name, total=total, unique_id=unique_id)
yield progress
def report_progress(self, message_text, unique_id=None):
- message = Message(unique_id, MessageType.INFO, message_text)
- self.message(message)
+ new_len = len(message_text)
+ if self._last_progress_length:
+ message_text = "\b" * (self._last_progress_length) + message_text
+ self._last_progress_length = new_len
+ sys.stderr.write(message_text)
+ sys.stderr.flush()
+
+ #message = Message(unique_id, MessageType.INFO, message_text)
+ #self.message(message)
# recorded_messages()
#
diff --git a/src/buildstream/_progress.py b/src/buildstream/_progress.py
index 2ad9e6a9d..d762f7385 100644
--- a/src/buildstream/_progress.py
+++ b/src/buildstream/_progress.py
@@ -49,5 +49,3 @@ class Progress():
if self._total is not None:
message_text += "/" + str(self._total)
self._context.report_progress(message_text, self._unique_id)
-
-