diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-11-18 23:52:15 -0500 |
---|---|---|
committer | Chris Larson <chris_larson@mentor.com> | 2010-11-21 11:24:47 -0700 |
commit | df7776f0bbbca99f09686b1d56c855cae16d2ec2 (patch) | |
tree | c6407afdd79288bd767a26e3c149dd12b591d417 /lib/bb/ui/knotty.py | |
parent | 64feb03bc2accecb49033df65e0a939ef5ab5986 (diff) | |
download | bitbake-df7776f0bbbca99f09686b1d56c855cae16d2ec2.tar.gz |
Split up the ParseProgress event
We now have ParseStarted, ParseProgress, and ParseCompleted. I think this
clarifies matters, and avoids sending all our statistics with every parse
progress event.
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib/bb/ui/knotty.py')
-rw-r--r-- | lib/bb/ui/knotty.py | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py index a2841bcd4..7412b39e8 100644 --- a/lib/bb/ui/knotty.py +++ b/lib/bb/ui/knotty.py @@ -78,6 +78,7 @@ def init(server, eventHandler): return 1 pbar = None + interactive = os.isatty(sys.stdout.fileno()) shutdown = 0 return_value = 0 while True: @@ -129,23 +130,26 @@ def init(server, eventHandler): if isinstance(event, bb.build.TaskBase): logger.info(event._message) continue + if isinstance(event, bb.event.ParseStarted): + if interactive: + pbar = progressbar.ProgressBar(widgets=widgets, + maxval=event.total).start() + else: + sys.stdout.write("Parsing recipes...") + sys.stdout.flush() + continue if isinstance(event, bb.event.ParseProgress): - current, total = event.sofar, event.total - if os.isatty(sys.stdout.fileno()): - if not pbar: - pbar = progressbar.ProgressBar(widgets=widgets, - maxval=total).start() - pbar.update(current) + if interactive: + pbar.update(event.current) + continue + if isinstance(event, bb.event.ParseCompleted): + if interactive: + pbar.update(event.total) else: - if current == 1: - sys.stdout.write("Parsing .bb files, please wait...") - sys.stdout.flush() - if current == total: - sys.stdout.write("done.") - sys.stdout.flush() - 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))) + sys.stdout.write("done.\n") + sys.stdout.flush() + 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 if isinstance(event, bb.command.CookerCommandCompleted): |