[bitbake-devel] [PATCH v3 14/15] terminal.bbclass: Allow OE_TERMINAL_PREFERRED to override the fallback order for OE_TERMINAL
Jason Wessel
jason.wessel at windriver.com
Wed Jun 6 20:28:38 UTC 2012
With the addition of two different modes for the use of screen, an end
user may prefer to set specific fall back order for an X vs tty
environment. This patch modifies the terminal.bbclass and terminal.py
to allow the variable OE_TERMINAL_PREFERRED to control the order of
trying the various supported OE_TERMINAL's.
Signed-off-by: Jason Wessel <jason.wessel at windriver.com>
---
meta/classes/terminal.bbclass | 3 ++-
meta/lib/oe/terminal.py | 8 +++++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/meta/classes/terminal.bbclass b/meta/classes/terminal.bbclass
index 3cfc84b..2be6974 100644
--- a/meta/classes/terminal.bbclass
+++ b/meta/classes/terminal.bbclass
@@ -4,6 +4,7 @@ OE_TERMINAL[choices] = 'auto none \
${@" ".join(o.name \
for o in oe.terminal.prioritized())}'
+OE_TERMINAL_PREFERRED ?= "auto"
OE_TERMINAL_EXPORTS = 'XAUTHORITY SHELL DBUS_SESSION_BUS_ADDRESS DISPLAY EXTRA_OEMAKE SCREENDIR'
OE_TERMINAL_EXPORTS[type] = 'list'
@@ -34,7 +35,7 @@ def oe_terminal(command, title, d):
bb.fatal('Unable to spawn terminal %s: %s' % (terminal, exc))
try:
- oe.terminal.spawn_preferred(command, title)
+ oe.terminal.spawn_preferred(d.getVar('OE_TERMINAL_PREFERRED', True), command, title)
except oe.terminal.NoSupportedTerminals:
bb.fatal('No valid terminal found, unable to open devshell')
except oe.terminal.ExecutionError as exc:
diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index ca94e73..943e5db 100644
--- a/meta/lib/oe/terminal.py
+++ b/meta/lib/oe/terminal.py
@@ -111,11 +111,13 @@ class Screen(Terminal):
def prioritized():
return Registry.prioritized()
-def spawn_preferred(command, title=None, env=None):
+def spawn_preferred(priorityList, command, title=None, env=None):
"""Spawn the first supported terminal, by priority"""
- for terminal in prioritized():
+ if priorityList == "auto":
+ priorityList = ' '.join(o.name for o in prioritized())
+ for terminal in priorityList.split():
try:
- spawn(terminal.name, command, title, env)
+ spawn(terminal, command, title, env)
break
except UnsupportedTerminal:
continue
--
1.7.10
More information about the bitbake-devel
mailing list