diff options
Diffstat (limited to 'bitbake/lib/bb/ui')
-rw-r--r-- | bitbake/lib/bb/ui/__init__.py | 1 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/__init__.py | 1 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/buildmanager.py | 90 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/runningbuild.py | 30 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/depexp.py | 21 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/goggle.py | 21 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 92 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/ncurses.py | 31 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/puccho.py | 130 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/uievent.py | 7 |
10 files changed, 213 insertions, 211 deletions
diff --git a/bitbake/lib/bb/ui/__init__.py b/bitbake/lib/bb/ui/__init__.py index c6a377a8e..a4805ed02 100644 --- a/bitbake/lib/bb/ui/__init__.py +++ b/bitbake/lib/bb/ui/__init__.py @@ -15,4 +15,3 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - diff --git a/bitbake/lib/bb/ui/crumbs/__init__.py b/bitbake/lib/bb/ui/crumbs/__init__.py index c6a377a8e..a4805ed02 100644 --- a/bitbake/lib/bb/ui/crumbs/__init__.py +++ b/bitbake/lib/bb/ui/crumbs/__init__.py @@ -15,4 +15,3 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - diff --git a/bitbake/lib/bb/ui/crumbs/buildmanager.py b/bitbake/lib/bb/ui/crumbs/buildmanager.py index f89e8eefd..e858d75e4 100644 --- a/bitbake/lib/bb/ui/crumbs/buildmanager.py +++ b/bitbake/lib/bb/ui/crumbs/buildmanager.py @@ -28,7 +28,7 @@ import time class BuildConfiguration: """ Represents a potential *or* historic *or* concrete build. It encompasses all the things that we need to tell bitbake to do to make it - build what we want it to build. + build what we want it to build. It also stored the metadata URL and the set of possible machines (and the distros / images / uris for these. Apart from the metdata URL these are @@ -73,34 +73,33 @@ class BuildConfiguration: return self.urls # It might be a lot lot better if we stored these in like, bitbake conf - # file format. - @staticmethod + # file format. + @staticmethod def load_from_file (filename): - f = open (filename, "r") conf = BuildConfiguration() - for line in f.readlines(): - data = line.split (";")[1] - if (line.startswith ("metadata-url;")): - conf.metadata_url = data.strip() - continue - if (line.startswith ("url;")): - conf.urls += [data.strip()] - continue - if (line.startswith ("extra-url;")): - conf.extra_urls += [data.strip()] - continue - if (line.startswith ("machine;")): - conf.machine = data.strip() - continue - if (line.startswith ("distribution;")): - conf.distro = data.strip() - continue - if (line.startswith ("image;")): - conf.image = data.strip() - continue + with open(filename, "r") as f: + for line in f: + data = line.split (";")[1] + if (line.startswith ("metadata-url;")): + conf.metadata_url = data.strip() + continue + if (line.startswith ("url;")): + conf.urls += [data.strip()] + continue + if (line.startswith ("extra-url;")): + conf.extra_urls += [data.strip()] + continue + if (line.startswith ("machine;")): + conf.machine = data.strip() + continue + if (line.startswith ("distribution;")): + conf.distro = data.strip() + continue + if (line.startswith ("image;")): + conf.image = data.strip() + continue - f.close () return conf # Serialise to a file. This is part of the build process and we use this @@ -140,13 +139,13 @@ class BuildResult(gobject.GObject): ".conf" in the directory for the build. This is GObject so that it can be included in the TreeStore.""" - + (STATE_COMPLETE, STATE_FAILED, STATE_ONGOING) = \ (0, 1, 2) def __init__ (self, parent, identifier): gobject.GObject.__init__ (self) - self.date = None + self.date = None self.files = [] self.status = None @@ -157,8 +156,8 @@ class BuildResult(gobject.GObject): # format build-<year><month><day>-<ordinal> we can easily # pull it out. # TODO: Better to stat a file? - (_ , date, revision) = identifier.split ("-") - print date + (_, date, revision) = identifier.split ("-") + print(date) year = int (date[0:4]) month = int (date[4:6]) @@ -181,7 +180,7 @@ class BuildResult(gobject.GObject): self.add_file (file) def add_file (self, file): - # Just add the file for now. Don't care about the type. + # Just add the file for now. Don't care about the type. self.files += [(file, None)] class BuildManagerModel (gtk.TreeStore): @@ -194,7 +193,7 @@ class BuildManagerModel (gtk.TreeStore): def __init__ (self): gtk.TreeStore.__init__ (self, - gobject.TYPE_STRING, + gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, @@ -207,7 +206,7 @@ class BuildManager (gobject.GObject): "results" directory but is also used for starting a new build.""" __gsignals__ = { - 'population-finished' : (gobject.SIGNAL_RUN_LAST, + 'population-finished' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()), 'populate-error' : (gobject.SIGNAL_RUN_LAST, @@ -220,13 +219,13 @@ class BuildManager (gobject.GObject): date = long (time.mktime (result.date.timetuple())) # Add a top level entry for the build - - self.model.set (iter, + + self.model.set (iter, BuildManagerModel.COL_IDENT, result.identifier, BuildManagerModel.COL_DESC, result.conf.image, - BuildManagerModel.COL_MACHINE, result.conf.machine, - BuildManagerModel.COL_DISTRO, result.conf.distro, - BuildManagerModel.COL_BUILD_RESULT, result, + BuildManagerModel.COL_MACHINE, result.conf.machine, + BuildManagerModel.COL_DISTRO, result.conf.distro, + BuildManagerModel.COL_BUILD_RESULT, result, BuildManagerModel.COL_DATE, date, BuildManagerModel.COL_STATE, result.state) @@ -257,7 +256,7 @@ class BuildManager (gobject.GObject): while (iter): (ident, state) = self.model.get(iter, - BuildManagerModel.COL_IDENT, + BuildManagerModel.COL_IDENT, BuildManagerModel.COL_STATE) if state == BuildResult.STATE_ONGOING: @@ -385,8 +384,8 @@ class BuildManager (gobject.GObject): build_directory]) server.runCommand(["buildTargets", [conf.image], "rootfs"]) - except Exception, e: - print e + except Exception as e: + print(e) class BuildManagerTreeView (gtk.TreeView): """ The tree view for the build manager. This shows the historic builds @@ -422,29 +421,29 @@ class BuildManagerTreeView (gtk.TreeView): # Misc descriptiony thing renderer = gtk.CellRendererText () - col = gtk.TreeViewColumn (None, renderer, + col = gtk.TreeViewColumn (None, renderer, text=BuildManagerModel.COL_DESC) self.append_column (col) # Machine renderer = gtk.CellRendererText () - col = gtk.TreeViewColumn ("Machine", renderer, + col = gtk.TreeViewColumn ("Machine", renderer, text=BuildManagerModel.COL_MACHINE) self.append_column (col) # distro renderer = gtk.CellRendererText () - col = gtk.TreeViewColumn ("Distribution", renderer, + col = gtk.TreeViewColumn ("Distribution", renderer, text=BuildManagerModel.COL_DISTRO) self.append_column (col) # date (using a custom function for formatting the cell contents it # takes epoch -> human readable string) renderer = gtk.CellRendererText () - col = gtk.TreeViewColumn ("Date", renderer, + col = gtk.TreeViewColumn ("Date", renderer, text=BuildManagerModel.COL_DATE) self.append_column (col) - col.set_cell_data_func (renderer, + col.set_cell_data_func (renderer, self.date_format_custom_cell_data_func) # For status. @@ -454,4 +453,3 @@ class BuildManagerTreeView (gtk.TreeView): self.append_column (col) col.set_cell_data_func (renderer, self.state_format_custom_cell_data_fun) - diff --git a/bitbake/lib/bb/ui/crumbs/runningbuild.py b/bitbake/lib/bb/ui/crumbs/runningbuild.py index 18afd6674..b4416ecbb 100644 --- a/bitbake/lib/bb/ui/crumbs/runningbuild.py +++ b/bitbake/lib/bb/ui/crumbs/runningbuild.py @@ -24,7 +24,7 @@ import gobject class RunningBuildModel (gtk.TreeStore): (COL_TYPE, COL_PACKAGE, COL_TASK, COL_MESSAGE, COL_ICON, COL_ACTIVE) = (0, 1, 2, 3, 4, 5) def __init__ (self): - gtk.TreeStore.__init__ (self, + gtk.TreeStore.__init__ (self, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, @@ -34,7 +34,7 @@ class RunningBuildModel (gtk.TreeStore): class RunningBuild (gobject.GObject): __gsignals__ = { - 'build-succeeded' : (gobject.SIGNAL_RUN_LAST, + 'build-succeeded' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()), 'build-failed' : (gobject.SIGNAL_RUN_LAST, @@ -63,7 +63,7 @@ class RunningBuild (gobject.GObject): # for the message. if hasattr(event, 'pid'): pid = event.pid - if self.pids_to_task.has_key(pid): + if pid in self.pids_to_task: (package, task) = self.pids_to_task[pid] parent = self.tasks_to_iter[(package, task)] @@ -82,29 +82,29 @@ class RunningBuild (gobject.GObject): # Add the message to the tree either at the top level if parent is # None otherwise as a descendent of a task. - self.model.append (parent, + self.model.append (parent, (event.__name__.split()[-1], # e.g. MsgWarn, MsgError - package, + package, task, event._message, - icon, + icon, False)) elif isinstance(event, bb.build.TaskStarted): (package, task) = (event._package, event._task) # Save out this PID. - self.pids_to_task[pid] = (package,task) + self.pids_to_task[pid] = (package, task) # Check if we already have this package in our model. If so then # that can be the parent for the task. Otherwise we create a new # top level for the package. - if (self.tasks_to_iter.has_key ((package, None))): + if ((package, None) in self.tasks_to_iter): parent = self.tasks_to_iter[(package, None)] else: - parent = self.model.append (None, (None, - package, + parent = self.model.append (None, (None, + package, None, - "Package: %s" % (package), + "Package: %s" % (package), None, False)) self.tasks_to_iter[(package, None)] = parent @@ -114,10 +114,10 @@ class RunningBuild (gobject.GObject): self.model.set(parent, self.model.COL_ICON, "gtk-execute") # Add an entry in the model for this task - i = self.model.append (parent, (None, - package, + i = self.model.append (parent, (None, + package, task, - "Task: %s" % (task), + "Task: %s" % (task), None, False)) @@ -176,5 +176,3 @@ class RunningBuildTreeView (gtk.TreeView): renderer = gtk.CellRendererText () col = gtk.TreeViewColumn ("Message", renderer, text=3) self.append_column (col) - - diff --git a/bitbake/lib/bb/ui/depexp.py b/bitbake/lib/bb/ui/depexp.py index cfa5b6564..1cd58cac1 100644 --- a/bitbake/lib/bb/ui/depexp.py +++ b/bitbake/lib/bb/ui/depexp.py @@ -201,14 +201,14 @@ def init(server, eventHandler): try: cmdline = server.runCommand(["getCmdLineAction"]) if not cmdline or cmdline[0] != "generateDotGraph": - print "This UI is only compatible with the -g option" + print("This UI is only compatible with the -g option") return ret = server.runCommand(["generateDepTreeEvent", cmdline[1], cmdline[2]]) if ret != True: - print "Couldn't run command! %s" % ret + print("Couldn't run command! %s" % ret) return - except xmlrpclib.Fault, x: - print "XMLRPC Fault getting commandline:\n %s" % x + except xmlrpclib.Fault as x: + print("XMLRPC Fault getting commandline:\n %s" % x) return shutdown = 0 @@ -233,8 +233,8 @@ def init(server, eventHandler): x = event.sofar y = event.total if x == y: - print("\nParsing finished. %d cached, %d parsed, %d skipped, %d masked, %d errors." - % ( event.cached, event.parsed, event.skipped, event.masked, event.errors)) + print(("\nParsing finished. %d cached, %d parsed, %d skipped, %d masked, %d errors." + % ( event.cached, event.parsed, event.skipped, event.masked, event.errors))) pbar.hide() gtk.gdk.threads_enter() pbar.progress.set_fraction(float(x)/float(y)) @@ -250,7 +250,7 @@ def init(server, eventHandler): if isinstance(event, bb.command.CookerCommandCompleted): continue if isinstance(event, bb.command.CookerCommandFailed): - print "Command execution failed: %s" % event.error + print("Command execution failed: %s" % event.error) break if isinstance(event, bb.cooker.CookerExit): break @@ -259,14 +259,13 @@ def init(server, eventHandler): except KeyboardInterrupt: if shutdown == 2: - print "\nThird Keyboard Interrupt, exit.\n" + print("\nThird Keyboard Interrupt, exit.\n") break if shutdown == 1: - print "\nSecond Keyboard Interrupt, stopping...\n" + print("\nSecond Keyboard Interrupt, stopping...\n") server.runCommand(["stateStop"]) if shutdown == 0: - print "\nKeyboard Interrupt, closing down...\n" + print("\nKeyboard Interrupt, closing down...\n") server.runCommand(["stateShutdown"]) shutdown = shutdown + 1 pass - diff --git a/bitbake/lib/bb/ui/goggle.py b/bitbake/lib/bb/ui/goggle.py index 94995d82d..2cfa002f8 100644 --- a/bitbake/lib/bb/ui/goggle.py +++ b/bitbake/lib/bb/ui/goggle.py @@ -25,13 +25,13 @@ from bb.ui.crumbs.runningbuild import RunningBuildTreeView, RunningBuild def event_handle_idle_func (eventHandler, build): - # Consume as many messages as we can in the time available to us - event = eventHandler.getEvent() - while event: - build.handle_event (event) - event = eventHandler.getEvent() + # Consume as many messages as we can in the time available to us + event = eventHandler.getEvent() + while event: + build.handle_event (event) + event = eventHandler.getEvent() - return True + return True class MainWindow (gtk.Window): def __init__ (self): @@ -55,15 +55,15 @@ def init (server, eventHandler): window.cur_build_tv.set_model (running_build.model) try: cmdline = server.runCommand(["getCmdLineAction"]) - print cmdline + print(cmdline) if not cmdline: return 1 ret = server.runCommand(cmdline) if ret != True: - print "Couldn't get default commandline! %s" % ret + print("Couldn't get default commandline! %s" % ret) return 1 - except xmlrpclib.Fault, x: - print "XMLRPC Fault getting commandline:\n %s" % x + except xmlrpclib.Fault as x: + print("XMLRPC Fault getting commandline:\n %s" % x) return 1 # Use a timeout function for probing the event queue to find out if we @@ -74,4 +74,3 @@ def init (server, eventHandler): running_build) gtk.main() - diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index ed26bb2b4..f81759abf 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -18,8 +18,9 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -import os +from __future__ import division +import os import sys import itertools import xmlrpclib @@ -44,10 +45,10 @@ def init(server, eventHandler): return 1 ret = server.runCommand(cmdline) if ret != True: - print "Couldn't get default commandline! %s" % ret + print("Couldn't get default commandline! %s" % ret) return 1 - except xmlrpclib.Fault, x: - print "XMLRPC Fault getting commandline:\n %s" % x + except xmlrpclib.Fault as x: + print("XMLRPC Fault getting commandline:\n %s" % x) return 1 shutdown = 0 @@ -65,39 +66,39 @@ def init(server, eventHandler): if shutdown and helper.needUpdate: activetasks, failedtasks = helper.getTasks() if activetasks: - print "Waiting for %s active tasks to finish:" % len(activetasks) + print("Waiting for %s active tasks to finish:" % len(activetasks)) tasknum = 1 for task in activetasks: - print "%s: %s (pid %s)" % (tasknum, activetasks[task]["title"], task) + print("%s: %s (pid %s)" % (tasknum, activetasks[task]["title"], task)) tasknum = tasknum + 1 if isinstance(event, bb.msg.MsgPlain): - print event._message + print(event._message) continue if isinstance(event, bb.msg.MsgDebug): - print 'DEBUG: ' + event._message + print('DEBUG: ' + event._message) continue if isinstance(event, bb.msg.MsgNote): - print 'NOTE: ' + event._message + print('NOTE: ' + event._message) continue if isinstance(event, bb.msg.MsgWarn): - print 'WARNING: ' + event._message + print('WARNING: ' + event._message) continue if isinstance(event, bb.msg.MsgError): return_value = 1 - print 'ERROR: ' + event._message + print('ERROR: ' + event._message) continue if isinstance(event, bb.msg.MsgFatal): return_value = 1 - print 'FATAL: ' + event._message + print('FATAL: ' + event._message) break if isinstance(event, bb.build.TaskFailed): return_value = 1 logfile = event.logfile - if logfile: - print "ERROR: Logfile of failure stored in: %s" % logfile + if logfile and os.path.exists(logfile): + print("ERROR: Logfile of failure stored in: %s" % logfile) if 1 or includelogs: - print "Log data follows:" + print("Log data follows:") f = open(logfile, "r") lines = [] while True: @@ -110,19 +111,19 @@ def init(server, eventHandler): if len(lines) > int(loglines): lines.pop(0) else: - print '| %s' % l + print('| %s' % l) f.close() if lines: for line in lines: - print line + print(line) if isinstance(event, bb.build.TaskBase): - print "NOTE: %s" % event._message + print("NOTE: %s" % event._message) continue if isinstance(event, bb.event.ParseProgress): x = event.sofar y = event.total if os.isatty(sys.stdout.fileno()): - sys.stdout.write("\rNOTE: Handling BitBake files: %s (%04d/%04d) [%2d %%]" % ( parsespin.next(), x, y, x*100/y ) ) + sys.stdout.write("\rNOTE: Handling BitBake files: %s (%04d/%04d) [%2d %%]" % ( next(parsespin), x, y, x*100//y ) ) sys.stdout.flush() else: if x == 1: @@ -132,8 +133,8 @@ def init(server, eventHandler): sys.stdout.write("done.") sys.stdout.flush() if x == y: - 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)) + 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): @@ -143,39 +144,48 @@ def init(server, eventHandler): continue if isinstance(event, bb.command.CookerCommandFailed): return_value = 1 - print "Command execution failed: %s" % event.error + print("Command execution failed: %s" % event.error) break if isinstance(event, bb.cooker.CookerExit): break - - # ignore - if isinstance(event, bb.event.BuildStarted): - continue - if isinstance(event, bb.event.BuildCompleted): - continue if isinstance(event, bb.event.MultipleProviders): + print("NOTE: multiple providers are available for %s%s (%s)" % (event._is_runtime and "runtime " or "", + event._item, + ", ".join(event._candidates))) + print("NOTE: consider defining a PREFERRED_PROVIDER entry to match %s" % event._item) + continue + if isinstance(event, bb.event.NoProvider): + if event._runtime: + r = "R" + else: + r = "" + + if event._dependees: + print("ERROR: Nothing %sPROVIDES '%s' (but %s %sDEPENDS on or otherwise requires it)" % (r, event._item, ", ".join(event._dependees), r)) + else: + print("ERROR: Nothing %sPROVIDES '%s'" % (r, event._item)) continue - if isinstance(event, bb.runqueue.runQueueEvent): - continue - if isinstance(event, bb.runqueue.runQueueExitWait): - continue - if isinstance(event, bb.event.StampUpdate): - continue - if isinstance(event, bb.event.ConfigParsed): - continue - if isinstance(event, bb.event.RecipeParsed): + + # ignore + if isinstance(event, (bb.event.BuildBase, + bb.event.StampUpdate, + bb.event.ConfigParsed, + bb.event.RecipeParsed, + bb.runqueue.runQueueEvent, + bb.runqueue.runQueueExitWait)): continue - print "Unknown Event: %s" % event + + print("Unknown Event: %s" % event) except KeyboardInterrupt: if shutdown == 2: - print "\nThird Keyboard Interrupt, exit.\n" + print("\nThird Keyboard Interrupt, exit.\n") break if shutdown == 1: - print "\nSecond Keyboard Interrupt, stopping...\n" + print("\nSecond Keyboard Interrupt, stopping...\n") server.runCommand(["stateStop"]) if shutdown == 0: - print "\nKeyboard Interrupt, closing down...\n" + print("\nKeyboard Interrupt, closing down...\n") server.runCommand(["stateShutdown"]) shutdown = shutdown + 1 pass diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py index 14310dc12..3fed4c58a 100644 --- a/bitbake/lib/bb/ui/ncurses.py +++ b/bitbake/lib/bb/ui/ncurses.py @@ -44,6 +44,8 @@ """ +from __future__ import division + import os, sys, curses, itertools, time import bb import xmlrpclib @@ -136,7 +138,7 @@ class NCursesUI: """Thread Activity Window""" def __init__( self, x, y, width, height ): NCursesUI.DecoratedWindow.__init__( self, "Thread Activity", x, y, width, height ) - + def setStatus( self, thread, text ): line = "%02d: %s" % ( thread, text ) width = self.dimensions[WIDTH] @@ -199,8 +201,8 @@ class NCursesUI: main_left = 0 main_top = 0 - main_height = ( height / 3 * 2 ) - main_width = ( width / 3 ) * 2 + main_height = ( height // 3 * 2 ) + main_width = ( width // 3 ) * 2 clo_left = main_left clo_top = main_top + main_height clo_height = height - main_height - main_top - 1 @@ -225,17 +227,17 @@ class NCursesUI: helper = uihelper.BBUIHelper() shutdown = 0 - + try: cmdline = server.runCommand(["getCmdLineAction"]) if not cmdline: return ret = server.runCommand(cmdline) if ret != True: - print "Couldn't get default commandlind! %s" % ret + print("Couldn't get default commandlind! %s" % ret) return - except xmlrpclib.Fault, x: - print "XMLRPC Fault getting commandline:\n %s" % x + except xmlrpclib.Fault as x: + print("XMLRPC Fault getting commandline:\n %s" % x) return exitflag = False @@ -246,7 +248,7 @@ class NCursesUI: continue helper.eventHandler(event) #mw.appendText("%s\n" % event[0]) - if isinstance(event, bb.build.Task): + if isinstance(event, bb.build.TaskBase): mw.appendText("NOTE: %s\n" % event._message) if isinstance(event, bb.msg.MsgDebug): mw.appendText('DEBUG: ' + event._message + '\n') @@ -263,10 +265,10 @@ class NCursesUI: y = event.total if x == y: mw.setStatus("Idle") - mw.appendText("Parsing finished. %d cached, %d parsed, %d skipped, %d masked." + mw.appendText("Parsing finished. %d cached, %d parsed, %d skipped, %d masked." % ( event.cached, event.parsed, event.skipped, event.masked )) else: - mw.setStatus("Parsing: %s (%04d/%04d) [%2d %%]" % ( parsespin.next(), x, y, x*100/y ) ) + mw.setStatus("Parsing: %s (%04d/%04d) [%2d %%]" % ( next(parsespin), x, y, x*100//y ) ) # if isinstance(event, bb.build.TaskFailed): # if event.logfile: # if data.getVar("BBINCLUDELOGS", d): @@ -301,12 +303,12 @@ class NCursesUI: taw.setText(0, 0, "") if activetasks: taw.appendText("Active Tasks:\n") - for task in activetasks: - taw.appendText(task) + for task in activetasks.itervalues(): + taw.appendText(task["title"]) if failedtasks: taw.appendText("Failed Tasks:\n") for task in failedtasks: - taw.appendText(task) + taw.appendText(task["title"]) curses.doupdate() except KeyboardInterrupt: @@ -324,7 +326,7 @@ class NCursesUI: def init(server, eventHandler): if not os.isatty(sys.stdout.fileno()): - print "FATAL: Unable to run 'ncurses' UI without a TTY." + print("FATAL: Unable to run 'ncurses' UI without a TTY.") return ui = NCursesUI() try: @@ -332,4 +334,3 @@ def init(server, eventHandler): except: import traceback traceback.print_exc() - diff --git a/bitbake/lib/bb/ui/puccho.py b/bitbake/lib/bb/ui/puccho.py index 713aa1f4a..a627fc803 100644 --- a/bitbake/lib/bb/ui/puccho.py +++ b/bitbake/lib/bb/ui/puccho.py @@ -24,6 +24,7 @@ import gtk.glade import threading import urllib2 import os +import contextlib from bb.ui.crumbs.buildmanager import BuildManager, BuildConfiguration from bb.ui.crumbs.buildmanager import BuildManagerTreeView @@ -38,7 +39,7 @@ class MetaDataLoader(gobject.GObject): on what machines are available. The distribution and images available for the machine and the the uris to use for building the given machine.""" __gsignals__ = { - 'success' : (gobject.SIGNAL_RUN_LAST, + 'success' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()), 'error' : (gobject.SIGNAL_RUN_LAST, @@ -77,20 +78,19 @@ class MetaDataLoader(gobject.GObject): def run (self): result = {} try: - f = urllib2.urlopen (self.url) - - # Parse the metadata format. The format is.... - # <machine>;<default distro>|<distro>...;<default image>|<image>...;<type##url>|... - for line in f.readlines(): - components = line.split(";") - if (len (components) < 4): - raise MetaDataLoader.LoaderThread.LoaderImportException - machine = components[0] - distros = components[1].split("|") - images = components[2].split("|") - urls = components[3].split("|") - - result[machine] = (distros, images, urls) + with contextlib.closing (urllib2.urlopen (self.url)) as f: + # Parse the metadata format. The format is.... + # <machine>;<default distro>|<distro>...;<default image>|<image>...;<type##url>|... + for line in f: + components = line.split(";") + if (len (components) < 4): + raise MetaDataLoader.LoaderThread.LoaderImportException + machine = components[0] + distros = components[1].split("|") + images = components[2].split("|") + urls = components[3].split("|") + + result[machine] = (distros, images, urls) # Create an object representing this *potential* # configuration. It can become concrete if the machine, distro @@ -104,13 +104,13 @@ class MetaDataLoader(gobject.GObject): gobject.idle_add (MetaDataLoader.emit_success_signal, self.loader) - except MetaDataLoader.LoaderThread.LoaderImportException, e: + except MetaDataLoader.LoaderThread.LoaderImportException as e: gobject.idle_add (MetaDataLoader.emit_error_signal, self.loader, "Repository metadata corrupt") - except Exception, e: + except Exception as e: gobject.idle_add (MetaDataLoader.emit_error_signal, self.loader, "Unable to download repository metadata") - print e + print(e) def try_fetch_from_url (self, url): # Try and download the metadata. Firing a signal if successful @@ -211,7 +211,7 @@ class BuildSetupDialog (gtk.Dialog): # Build button = gtk.Button ("_Build", None, True) image = gtk.Image () - image.set_from_stock (gtk.STOCK_EXECUTE,gtk.ICON_SIZE_BUTTON) + image.set_from_stock (gtk.STOCK_EXECUTE, gtk.ICON_SIZE_BUTTON) button.set_image (image) self.add_action_widget (button, BuildSetupDialog.RESPONSE_BUILD) button.show_all () @@ -293,7 +293,7 @@ class BuildSetupDialog (gtk.Dialog): if (active_iter): self.configuration.machine = model.get(active_iter, 0)[0] - # Extract the chosen distro from the combo + # Extract the chosen distro from the combo model = self.distribution_combo.get_model() active_iter = self.distribution_combo.get_active_iter() if (active_iter): @@ -311,62 +311,62 @@ class BuildSetupDialog (gtk.Dialog): # # TODO: Should be a method on the RunningBuild class def event_handle_timeout (eventHandler, build): - # Consume as many messages as we can ... - event = eventHandler.getEvent() - while event: - build.handle_event (event) - event = eventHandler.getEvent() - return True + # Consume as many messages as we can ... + event = eventHandler.getEvent() + while event: + build.handle_event (event) + event = eventHandler.getEvent() + return True class MainWindow (gtk.Window): - # Callback that gets fired when the user hits a button in the - # BuildSetupDialog. - def build_dialog_box_response_cb (self, dialog, response_id): - conf = None - if (response_id == BuildSetupDialog.RESPONSE_BUILD): - dialog.update_configuration() - print dialog.configuration.machine, dialog.configuration.distro, \ - dialog.configuration.image - conf = dialog.configuration + # Callback that gets fired when the user hits a button in the + # BuildSetupDialog. + def build_dialog_box_response_cb (self, dialog, response_id): + conf = None + if (response_id == BuildSetupDialog.RESPONSE_BUILD): + dialog.update_configuration() + print(dialog.configuration.machine, dialog.configuration.distro, \ + dialog.configuration.image) + conf = dialog.configuration - dialog.destroy() + dialog.destroy() - if conf: - self.manager.do_build (conf) + if conf: + self.manager.do_build (conf) - def build_button_clicked_cb (self, button): - dialog = BuildSetupDialog () + def build_button_clicked_cb (self, button): + dialog = BuildSetupDialog () - # For some unknown reason Dialog.run causes nice little deadlocks ... :-( - dialog.connect ("response", self.build_dialog_box_response_cb) - dialog.show() + # For some unknown reason Dialog.run causes nice little deadlocks ... :-( + dialog.connect ("response", self.build_dialog_box_response_cb) + dialog.show() - def __init__ (self): - gtk.Window.__init__ (self) + def __init__ (self): + gtk.Window.__init__ (self) - # Pull in *just* the main vbox from the Glade XML data and then pack - # that inside the window - gxml = gtk.glade.XML (os.path.dirname(__file__) + "/crumbs/puccho.glade", - root = "main_window_vbox") - vbox = gxml.get_widget ("main_window_vbox") - self.add (vbox) + # Pull in *just* the main vbox from the Glade XML data and then pack + # that inside the window + gxml = gtk.glade.XML (os.path.dirname(__file__) + "/crumbs/puccho.glade", + root = "main_window_vbox") + vbox = gxml.get_widget ("main_window_vbox") + self.add (vbox) - # Create the tree views for the build manager view and the progress view - self.build_manager_view = BuildManagerTreeView() - self.running_build_view = RunningBuildTreeView() + # Create the tree views for the build manager view and the progress view + self.build_manager_view = BuildManagerTreeView() + self.running_build_view = RunningBuildTreeView() - # Grab the scrolled windows that we put the tree views into - self.results_scrolledwindow = gxml.get_widget ("results_scrolledwindow") - self.progress_scrolledwindow = gxml.get_widget ("progress_scrolledwindow") + # Grab the scrolled windows that we put the tree views into + self.results_scrolledwindow = gxml.get_widget ("results_scrolledwindow") + self.progress_scrolledwindow = gxml.get_widget ("progress_scrolledwindow") - # Put the tree views inside ... - self.results_scrolledwindow.add (self.build_manager_view) - self.progress_scrolledwindow.add (self.running_build_view) + # Put the tree views inside ... + self.results_scrolledwindow.add (self.build_manager_view) + self.progress_scrolledwindow.add (self.running_build_view) - # Hook up the build button... - self.build_button = gxml.get_widget ("main_toolbutton_build") - self.build_button.connect ("clicked", self.build_button_clicked_cb) + # Hook up the build button... + self.build_button = gxml.get_widget ("main_toolbutton_build") + self.build_button.connect ("clicked", self.build_button_clicked_cb) # I'm not very happy about the current ownership of the RunningBuild. I have # my suspicions that this object should be held by the BuildManager since we @@ -383,11 +383,11 @@ def running_build_succeeded_cb (running_build, manager): # BuildManager. It can then hook onto the signals directly and drive # interesting things it cares about. manager.notify_build_succeeded () - print "build succeeded" + print("build succeeded") def running_build_failed_cb (running_build, manager): # As above - print "build failed" + print("build failed") manager.notify_build_failed () def init (server, eventHandler): diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py index 36302f4da..f1e4d791e 100644 --- a/bitbake/lib/bb/ui/uievent.py +++ b/bitbake/lib/bb/ui/uievent.py @@ -19,7 +19,7 @@ """ -Use this class to fork off a thread to recieve event callbacks from the bitbake +Use this class to fork off a thread to recieve event callbacks from the bitbake server and queue them for the UI to process. This process must be used to avoid client/server deadlocks. """ @@ -110,16 +110,15 @@ class UIXMLRPCServer (SimpleXMLRPCServer): return (sock, addr) except socket.timeout: pass - return (None,None) + return (None, None) def close_request(self, request): if request is None: return SimpleXMLRPCServer.close_request(self, request) - + def process_request(self, request, client_address): if request is None: return SimpleXMLRPCServer.process_request(self, request, client_address) - |