summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb/ui/crumbs/buildmanager.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/buildmanager.py')
-rw-r--r--bitbake/lib/bb/ui/crumbs/buildmanager.py90
1 files changed, 44 insertions, 46 deletions
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)
-