summaryrefslogtreecommitdiffstats
path: root/bitbake-dev
diff options
context:
space:
mode:
authorRob Bradford <rob@linux.intel.com>2008-10-21 12:39:23 +0100
committerRob Bradford <rob@linux.intel.com>2008-10-21 12:39:23 +0100
commit3e045793c740cbac302c2077cc839f1a64c03bc2 (patch)
tree5990f30819c846392e242cc77e3465e9194e66d1 /bitbake-dev
parent7ddbeb29315ccc93cebf10c3f52663110f5b8168 (diff)
downloadpoky-3e045793c740cbac302c2077cc839f1a64c03bc2.tar.gz
bitbake-dev: Dynamically load the UI module.
Dynamically load the UI from a module based on the UI name given. We still however maintain a fixed set in here with the set of suggested UIs.
Diffstat (limited to 'bitbake-dev')
-rwxr-xr-xbitbake-dev/bin/bitbake39
1 files changed, 14 insertions, 25 deletions
diff --git a/bitbake-dev/bin/bitbake b/bitbake-dev/bin/bitbake
index 1f650e2bdc..d85135a117 100755
--- a/bitbake-dev/bin/bitbake
+++ b/bitbake-dev/bin/bitbake
@@ -123,21 +123,6 @@ Default BBFILES are the .bb files in the current directory.""" )
123 configuration.pkgs_to_build = [] 123 configuration.pkgs_to_build = []
124 configuration.pkgs_to_build.extend(args[1:]) 124 configuration.pkgs_to_build.extend(args[1:])
125 125
126 # Work out which UI(s) to use
127 curseUI = False
128 depexplorerUI = False
129 if configuration.ui:
130 if configuration.ui == "ncurses":
131 curseUI = True
132 elif configuration.ui == "knotty" or configuration.ui == "tty" or configuration.ui == "file":
133 curseUI = False
134 elif configuration.ui == "depexp":
135 depexplorerUI = True
136 else:
137 print "FATAL: Invalid user interface '%s' specified.\nValid interfaces are 'ncurses', 'depexp' or the default, 'knotty'." % configuration.ui
138 sys.exit(1)
139
140
141 cooker = bb.cooker.BBCooker(configuration) 126 cooker = bb.cooker.BBCooker(configuration)
142 127
143 # Clear away any spurious environment variables. But don't wipe the 128 # Clear away any spurious environment variables. But don't wipe the
@@ -166,18 +151,22 @@ Default BBFILES are the .bb files in the current directory.""" )
166 eventHandler = uievent.BBUIEventQueue(server) 151 eventHandler = uievent.BBUIEventQueue(server)
167 152
168 # Launch the UI 153 # Launch the UI
154 if configuration.ui:
155 ui = configuration.ui
156 else:
157 ui = "knotty"
158
169 try: 159 try:
170 if curseUI: 160 # Dynamically load the UI based on the ui name. Although we
171 from bb.ui import ncurses 161 # suggest a fixed set this allows you to have flexibility in which
172 ncurses.init(server, eventHandler) 162 # ones are available.
173 elif depexplorerUI: 163 exec "from bb.ui import " + ui
174 from bb.ui import depexplorer 164 exec ui + ".init(server, eventHandler)"
175 depexplorer.init(server, eventHandler) 165 except ImportError:
176 else: 166 print "FATAL: Invalid user interface '%s' specified. " % ui
177 from bb.ui import knotty 167 print "Valid interfaces are 'ncurses', 'depexp' or the default, 'knotty'."
178 return_value = knotty.init(server, eventHandler)
179 except Exception, e: 168 except Exception, e:
180 print "FATAL: Unable to start to '%s' UI: %s" % (configuration.ui, e.message) 169 print "FATAL: Unable to start to '%s' UI: %s." % (configuration.ui, e.message)
181 finally: 170 finally:
182 # Don't wait for server indefinitely 171 # Don't wait for server indefinitely
183 import socket 172 import socket