diff options
| -rw-r--r-- | meta/classes/terminal.bbclass | 10 | ||||
| -rw-r--r-- | meta/lib/oe/terminal.py | 17 |
2 files changed, 22 insertions, 5 deletions
diff --git a/meta/classes/terminal.bbclass b/meta/classes/terminal.bbclass index 2cd6f4c34f..51846c125c 100644 --- a/meta/classes/terminal.bbclass +++ b/meta/classes/terminal.bbclass | |||
| @@ -4,7 +4,7 @@ OE_TERMINAL[choices] = 'auto none \ | |||
| 4 | ${@" ".join(o.name \ | 4 | ${@" ".join(o.name \ |
| 5 | for o in oe.terminal.prioritized())}' | 5 | for o in oe.terminal.prioritized())}' |
| 6 | 6 | ||
| 7 | OE_TERMINAL_EXPORTS = 'XAUTHORITY SHELL DBUS_SESSION_BUS_ADDRESS DISPLAY EXTRA_OEMAKE SCREENDIR' | 7 | OE_TERMINAL_EXPORTS += 'XAUTHORITY SHELL DBUS_SESSION_BUS_ADDRESS DISPLAY EXTRA_OEMAKE SCREENDIR' |
| 8 | OE_TERMINAL_EXPORTS[type] = 'list' | 8 | OE_TERMINAL_EXPORTS[type] = 'list' |
| 9 | 9 | ||
| 10 | XAUTHORITY ?= "${HOME}/.Xauthority" | 10 | XAUTHORITY ?= "${HOME}/.Xauthority" |
| @@ -15,17 +15,19 @@ def oe_terminal(command, title, d): | |||
| 15 | import oe.data | 15 | import oe.data |
| 16 | import oe.terminal | 16 | import oe.terminal |
| 17 | 17 | ||
| 18 | env = dict() | ||
| 19 | |||
| 18 | for export in oe.data.typed_value('OE_TERMINAL_EXPORTS', d): | 20 | for export in oe.data.typed_value('OE_TERMINAL_EXPORTS', d): |
| 19 | value = d.getVar(export, True) | 21 | value = d.getVar(export, True) |
| 20 | if value is not None: | 22 | if value is not None: |
| 21 | os.environ[export] = str(value) | 23 | env[export] = str(value) |
| 22 | 24 | ||
| 23 | terminal = oe.data.typed_value('OE_TERMINAL', d).lower() | 25 | terminal = oe.data.typed_value('OE_TERMINAL', d).lower() |
| 24 | if terminal == 'none': | 26 | if terminal == 'none': |
| 25 | bb.fatal('Devshell usage disabled with OE_TERMINAL') | 27 | bb.fatal('Devshell usage disabled with OE_TERMINAL') |
| 26 | elif terminal != 'auto': | 28 | elif terminal != 'auto': |
| 27 | try: | 29 | try: |
| 28 | oe.terminal.spawn(terminal, command, title, None, d) | 30 | oe.terminal.spawn(terminal, command, title, env, d) |
| 29 | return | 31 | return |
| 30 | except oe.terminal.UnsupportedTerminal: | 32 | except oe.terminal.UnsupportedTerminal: |
| 31 | bb.warn('Unsupported terminal "%s", defaulting to "auto"' % | 33 | bb.warn('Unsupported terminal "%s", defaulting to "auto"' % |
| @@ -34,7 +36,7 @@ def oe_terminal(command, title, d): | |||
| 34 | bb.fatal('Unable to spawn terminal %s: %s' % (terminal, exc)) | 36 | bb.fatal('Unable to spawn terminal %s: %s' % (terminal, exc)) |
| 35 | 37 | ||
| 36 | try: | 38 | try: |
| 37 | oe.terminal.spawn_preferred(command, title, None, d) | 39 | oe.terminal.spawn_preferred(command, title, env, d) |
| 38 | except oe.terminal.NoSupportedTerminals: | 40 | except oe.terminal.NoSupportedTerminals: |
| 39 | bb.fatal('No valid terminal found, unable to open devshell') | 41 | bb.fatal('No valid terminal found, unable to open devshell') |
| 40 | except oe.terminal.ExecutionError as exc: | 42 | except oe.terminal.ExecutionError as exc: |
diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py index 71d8a43410..4c1e318c7c 100644 --- a/meta/lib/oe/terminal.py +++ b/meta/lib/oe/terminal.py | |||
| @@ -47,7 +47,7 @@ class Terminal(Popen): | |||
| 47 | 47 | ||
| 48 | class XTerminal(Terminal): | 48 | class XTerminal(Terminal): |
| 49 | def __init__(self, sh_cmd, title=None, env=None, d=None): | 49 | def __init__(self, sh_cmd, title=None, env=None, d=None): |
| 50 | Terminal.__init__(self, sh_cmd, title, env) | 50 | Terminal.__init__(self, sh_cmd, title, env, d) |
| 51 | if not os.environ.get('DISPLAY'): | 51 | if not os.environ.get('DISPLAY'): |
| 52 | raise UnsupportedTerminal(self.name) | 52 | raise UnsupportedTerminal(self.name) |
| 53 | 53 | ||
| @@ -105,6 +105,21 @@ class Screen(Terminal): | |||
| 105 | else: | 105 | else: |
| 106 | logger.warn(msg) | 106 | logger.warn(msg) |
| 107 | 107 | ||
| 108 | class Custom(Terminal): | ||
| 109 | command = 'false' # This is a placeholder | ||
| 110 | priority = 3 | ||
| 111 | |||
| 112 | def __init__(self, sh_cmd, title=None, env=None, d=None): | ||
| 113 | self.command = d and d.getVar('OE_TERMINAL_CUSTOMCMD', True) | ||
| 114 | if self.command: | ||
| 115 | if not '{command}' in self.command: | ||
| 116 | self.command += ' {command}' | ||
| 117 | Terminal.__init__(self, sh_cmd, title, env, d) | ||
| 118 | logger.warn('Custom terminal was started.') | ||
| 119 | else: | ||
| 120 | logger.debug(1, 'No custom terminal (OE_TERMINAL_CUSTOMCMD) set') | ||
| 121 | raise UnsupportedTerminal('OE_TERMINAL_CUSTOMCMD not set') | ||
| 122 | |||
| 108 | 123 | ||
| 109 | def prioritized(): | 124 | def prioritized(): |
| 110 | return Registry.prioritized() | 125 | return Registry.prioritized() |
