aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-12-13 16:24:14 -0700
committerChris Larson <chris_larson@mentor.com>2010-12-13 16:24:14 -0700
commit76aeea2c23a518046d0b26f1a6fc43287a180a9d (patch)
treefbc62507bfdf0f361aa78977376bc9154ad1f170 /bin
parentefa5485c8f9d488ba058c40734cc55296d3de6eb (diff)
downloadbitbake-76aeea2c23a518046d0b26f1a6fc43287a180a9d.tar.gz
Ensure that the invalid UI error goes to stderr
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bitbake37
1 files changed, 20 insertions, 17 deletions
diff --git a/bin/bitbake b/bin/bitbake
index 58dc1bd67..d88d6c713 100755
--- a/bin/bitbake
+++ b/bin/bitbake
@@ -56,6 +56,23 @@ class BBConfiguration(object):
self.pkgs_to_build = []
+def get_ui(config):
+ if config.ui:
+ interface = config.ui
+ else:
+ interface = 'knotty'
+
+ try:
+ # 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.
+ module = __import__("bb.ui", fromlist = [interface])
+ return getattr(module, interface).main
+ except AttributeError:
+ sys.exit("FATAL: Invalid user interface '%s' specified.\n"
+ "Valid interfaces: ncurses, depexp, knotty [default]." % interface)
+
+
# Display bitbake/OE warnings via the BitBake.Warnings logger, ignoring others"""
warnlog = logging.getLogger("BitBake.Warnings")
_warnings_showwarning = warnings.showwarning
@@ -148,6 +165,8 @@ Default BBFILES are the .bb files in the current directory.""")
configuration = BBConfiguration(options)
configuration.pkgs_to_build.extend(args[1:])
+ ui_main = get_ui(configuration)
+
loghandler = event.LogHandler()
logger.addHandler(loghandler)
@@ -178,24 +197,8 @@ Default BBFILES are the .bb files in the current directory.""")
# Setup a connection to the server (cooker)
server_connection = server.BitBakeServerConnection(serverinfo)
- # Launch the UI
- if configuration.ui:
- ui = configuration.ui
- else:
- ui = "knotty"
-
try:
- try:
- # 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.
- module = __import__("bb.ui", fromlist = [ui])
- ui_main = getattr(module, ui).main
- except AttributeError:
- print("FATAL: Invalid user interface '%s' specified. " % ui)
- print("Valid interfaces are 'ncurses', 'depexp' or the default, 'knotty'.")
- else:
- return ui_main(server_connection.connection, server_connection.events)
+ return ui_main(server_connection.connection, server_connection.events)
finally:
server_connection.terminate()