summaryrefslogtreecommitdiffstats
path: root/lib/bb/ui/knotty.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-11-18 21:15:07 -0700
committerChris Larson <chris_larson@mentor.com>2010-11-21 11:24:46 -0700
commit64feb03bc2accecb49033df65e0a939ef5ab5986 (patch)
tree95212108f7cd5bf3f3480131662c73a0f2760ff4 /lib/bb/ui/knotty.py
parentc7b3ec819549e51e438d293969e205883fee725f (diff)
downloadbitbake-64feb03bc2accecb49033df65e0a939ef5ab5986.tar.gz
Experimental usage of the 'progressbar' module
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib/bb/ui/knotty.py')
-rw-r--r--lib/bb/ui/knotty.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index 516c78de6..a2841bcd4 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -25,11 +25,13 @@ import sys
import itertools
import xmlrpclib
import logging
+import progressbar
from bb import ui
from bb.ui import uihelper
logger = logging.getLogger("BitBake")
-parsespin = itertools.cycle( r'|/-\\' )
+widgets = ['Parsing recipes: ', progressbar.Percentage(), ' ',
+ progressbar.Bar(), ' ', progressbar.ETA()]
class BBLogFormatter(logging.Formatter):
"""Formatter which ensures that our 'plain' messages (logging.INFO + 1) are used as is"""
@@ -75,6 +77,7 @@ def init(server, eventHandler):
print("XMLRPC Fault getting commandline:\n %s" % x)
return 1
+ pbar = None
shutdown = 0
return_value = 0
while True:
@@ -127,19 +130,20 @@ def init(server, eventHandler):
logger.info(event._message)
continue
if isinstance(event, bb.event.ParseProgress):
- x = event.sofar
- y = event.total
+ current, total = event.sofar, event.total
if os.isatty(sys.stdout.fileno()):
- sys.stdout.write("\rNOTE: Handling BitBake files: %s (%04d/%04d) [%2d %%]" % ( next(parsespin), x, y, x*100//y ) )
- sys.stdout.flush()
+ if not pbar:
+ pbar = progressbar.ProgressBar(widgets=widgets,
+ maxval=total).start()
+ pbar.update(current)
else:
- if x == 1:
+ if current == 1:
sys.stdout.write("Parsing .bb files, please wait...")
sys.stdout.flush()
- if x == y:
+ if current == total:
sys.stdout.write("done.")
sys.stdout.flush()
- if x == y:
+ if current == total:
print(("\nParsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors."
% ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors)))
continue