diff options
| -rwxr-xr-x | bitbake/bin/bitbake | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake index 6458d987c0..61bd0194d6 100755 --- a/bitbake/bin/bitbake +++ b/bitbake/bin/bitbake | |||
| @@ -57,6 +57,23 @@ class BBConfiguration(object): | |||
| 57 | self.pkgs_to_build = [] | 57 | self.pkgs_to_build = [] |
| 58 | 58 | ||
| 59 | 59 | ||
| 60 | def get_ui(config): | ||
| 61 | if config.ui: | ||
| 62 | interface = config.ui | ||
| 63 | else: | ||
| 64 | interface = 'knotty' | ||
| 65 | |||
| 66 | try: | ||
| 67 | # Dynamically load the UI based on the ui name. Although we | ||
| 68 | # suggest a fixed set this allows you to have flexibility in which | ||
| 69 | # ones are available. | ||
| 70 | module = __import__("bb.ui", fromlist = [interface]) | ||
| 71 | return getattr(module, interface).main | ||
| 72 | except AttributeError: | ||
| 73 | sys.exit("FATAL: Invalid user interface '%s' specified.\n" | ||
| 74 | "Valid interfaces: ncurses, depexp, knotty [default]." % interface) | ||
| 75 | |||
| 76 | |||
| 60 | # Display bitbake/OE warnings via the BitBake.Warnings logger, ignoring others""" | 77 | # Display bitbake/OE warnings via the BitBake.Warnings logger, ignoring others""" |
| 61 | warnlog = logging.getLogger("BitBake.Warnings") | 78 | warnlog = logging.getLogger("BitBake.Warnings") |
| 62 | _warnings_showwarning = warnings.showwarning | 79 | _warnings_showwarning = warnings.showwarning |
| @@ -153,6 +170,8 @@ Default BBFILES are the .bb files in the current directory.""") | |||
| 153 | configuration.pkgs_to_build.extend(args[1:]) | 170 | configuration.pkgs_to_build.extend(args[1:]) |
| 154 | configuration.initial_path = os.environ['PATH'] | 171 | configuration.initial_path = os.environ['PATH'] |
| 155 | 172 | ||
| 173 | ui_main = get_ui(configuration) | ||
| 174 | |||
| 156 | loghandler = event.LogHandler() | 175 | loghandler = event.LogHandler() |
| 157 | logger.addHandler(loghandler) | 176 | logger.addHandler(loghandler) |
| 158 | 177 | ||
| @@ -191,17 +210,7 @@ Default BBFILES are the .bb files in the current directory.""") | |||
| 191 | ui = "knotty" | 210 | ui = "knotty" |
| 192 | 211 | ||
| 193 | try: | 212 | try: |
| 194 | try: | 213 | return server.BitbakeUILauch().launch(serverinfo, ui_main, server_connection.connection, server_connection.events) |
| 195 | # Dynamically load the UI based on the ui name. Although we | ||
| 196 | # suggest a fixed set this allows you to have flexibility in which | ||
| 197 | # ones are available. | ||
| 198 | module = __import__("bb.ui", fromlist = [ui]) | ||
| 199 | ui_main = getattr(module, ui).main | ||
| 200 | except AttributeError: | ||
| 201 | print("FATAL: Invalid user interface '%s' specified. " % ui) | ||
| 202 | print("Valid interfaces are 'ncurses', 'depexp' or the default, 'knotty'.") | ||
| 203 | else: | ||
| 204 | return server.BitbakeUILauch().launch(serverinfo, ui_main, server_connection.connection, server_connection.events) | ||
| 205 | finally: | 214 | finally: |
| 206 | server_connection.terminate() | 215 | server_connection.terminate() |
| 207 | 216 | ||
