aboutsummaryrefslogtreecommitdiffstats
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)
downloadopenembedded-core-contrib-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.""" )
configuration.pkgs_to_build = []
configuration.pkgs_to_build.extend(args[1:])
- # Work out which UI(s) to use
- curseUI = False
- depexplorerUI = False
- if configuration.ui:
- if configuration.ui == "ncurses":
- curseUI = True
- elif configuration.ui == "knotty" or configuration.ui == "tty" or configuration.ui == "file":
- curseUI = False
- elif configuration.ui == "depexp":
- depexplorerUI = True
- else:
- print "FATAL: Invalid user interface '%s' specified.\nValid interfaces are 'ncurses', 'depexp' or the default, 'knotty'." % configuration.ui
- sys.exit(1)
-
-
cooker = bb.cooker.BBCooker(configuration)
# 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.""" )
eventHandler = uievent.BBUIEventQueue(server)
# Launch the UI
+ if configuration.ui:
+ ui = configuration.ui
+ else:
+ ui = "knotty"
+
try:
- if curseUI:
- from bb.ui import ncurses
- ncurses.init(server, eventHandler)
- elif depexplorerUI:
- from bb.ui import depexplorer
- depexplorer.init(server, eventHandler)
- else:
- from bb.ui import knotty
- return_value = knotty.init(server, eventHandler)
+ # Dynamically load the UI based on the ui name. Although we
+ # suggest a fixed set this allows you to have flexibility in which
+ # ones are available.
+ exec "from bb.ui import " + ui
+ exec ui + ".init(server, eventHandler)"
+ except ImportError:
+ print "FATAL: Invalid user interface '%s' specified. " % ui
+ print "Valid interfaces are 'ncurses', 'depexp' or the default, 'knotty'."
except Exception, e:
- print "FATAL: Unable to start to '%s' UI: %s" % (configuration.ui, e.message)
+ print "FATAL: Unable to start to '%s' UI: %s." % (configuration.ui, e.message)
finally:
# Don't wait for server indefinitely
import socket