diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2012-09-17 17:43:50 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-24 15:35:30 +0100 |
commit | 6e0713a3e7765bafebd48e33b943f83ac17720ea (patch) | |
tree | 058e11f349358a9533449ac4542a02531b6f899c /meta | |
parent | e1c1ee19e04eca1ffd09b49104a7b49e89c74d12 (diff) | |
download | poky-6e0713a3e7765bafebd48e33b943f83ac17720ea.tar.gz |
terminal: pass data store all the way through to terminal class
Passing the data store will be needed for firing a custom event
for the screen class.
(From OE-Core rev: 5ccff8d44626bfd3d1af2a7f81f0567997277809)
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/terminal.bbclass | 4 | ||||
-rw-r--r-- | meta/lib/oe/terminal.py | 22 |
2 files changed, 13 insertions, 13 deletions
diff --git a/meta/classes/terminal.bbclass b/meta/classes/terminal.bbclass index 3cfc84b444..2cd6f4c34f 100644 --- a/meta/classes/terminal.bbclass +++ b/meta/classes/terminal.bbclass | |||
@@ -25,7 +25,7 @@ def oe_terminal(command, title, d): | |||
25 | bb.fatal('Devshell usage disabled with OE_TERMINAL') | 25 | bb.fatal('Devshell usage disabled with OE_TERMINAL') |
26 | elif terminal != 'auto': | 26 | elif terminal != 'auto': |
27 | try: | 27 | try: |
28 | oe.terminal.spawn(terminal, command, title) | 28 | oe.terminal.spawn(terminal, command, title, None, d) |
29 | return | 29 | return |
30 | except oe.terminal.UnsupportedTerminal: | 30 | except oe.terminal.UnsupportedTerminal: |
31 | bb.warn('Unsupported terminal "%s", defaulting to "auto"' % | 31 | bb.warn('Unsupported terminal "%s", defaulting to "auto"' % |
@@ -34,7 +34,7 @@ def oe_terminal(command, title, d): | |||
34 | bb.fatal('Unable to spawn terminal %s: %s' % (terminal, exc)) | 34 | bb.fatal('Unable to spawn terminal %s: %s' % (terminal, exc)) |
35 | 35 | ||
36 | try: | 36 | try: |
37 | oe.terminal.spawn_preferred(command, title) | 37 | oe.terminal.spawn_preferred(command, title, None, d) |
38 | except oe.terminal.NoSupportedTerminals: | 38 | except oe.terminal.NoSupportedTerminals: |
39 | bb.fatal('No valid terminal found, unable to open devshell') | 39 | bb.fatal('No valid terminal found, unable to open devshell') |
40 | except oe.terminal.ExecutionError as exc: | 40 | except oe.terminal.ExecutionError as exc: |
diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py index 30e8f92004..352a28239a 100644 --- a/meta/lib/oe/terminal.py +++ b/meta/lib/oe/terminal.py | |||
@@ -27,7 +27,7 @@ class Registry(oe.classutils.ClassRegistry): | |||
27 | class Terminal(Popen): | 27 | class Terminal(Popen): |
28 | __metaclass__ = Registry | 28 | __metaclass__ = Registry |
29 | 29 | ||
30 | def __init__(self, sh_cmd, title=None, env=None): | 30 | def __init__(self, sh_cmd, title=None, env=None, d=None): |
31 | fmt_sh_cmd = self.format_command(sh_cmd, title) | 31 | fmt_sh_cmd = self.format_command(sh_cmd, title) |
32 | try: | 32 | try: |
33 | Popen.__init__(self, fmt_sh_cmd, env=env) | 33 | Popen.__init__(self, fmt_sh_cmd, env=env) |
@@ -46,7 +46,7 @@ class Terminal(Popen): | |||
46 | return [element.format(**fmt) for element in self.command] | 46 | return [element.format(**fmt) for element in self.command] |
47 | 47 | ||
48 | class XTerminal(Terminal): | 48 | class XTerminal(Terminal): |
49 | def __init__(self, sh_cmd, title=None, env=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) |
51 | if not os.environ.get('DISPLAY'): | 51 | if not os.environ.get('DISPLAY'): |
52 | raise UnsupportedTerminal(self.name) | 52 | raise UnsupportedTerminal(self.name) |
@@ -59,7 +59,7 @@ class Xfce(XTerminal): | |||
59 | command = 'Terminal -T "{title}" -e "{command}"' | 59 | command = 'Terminal -T "{title}" -e "{command}"' |
60 | priority = 2 | 60 | priority = 2 |
61 | 61 | ||
62 | def __init__(self, command, title=None, env=None): | 62 | def __init__(self, command, title=None, env=None, d=None): |
63 | # Upstream binary name is Terminal but Debian/Ubuntu use | 63 | # Upstream binary name is Terminal but Debian/Ubuntu use |
64 | # xfce4-terminal to avoid possible(?) conflicts | 64 | # xfce4-terminal to avoid possible(?) conflicts |
65 | distro = distro_name() | 65 | distro = distro_name() |
@@ -67,20 +67,20 @@ class Xfce(XTerminal): | |||
67 | cmd = 'xfce4-terminal -T "{title}" -e "{command}"' | 67 | cmd = 'xfce4-terminal -T "{title}" -e "{command}"' |
68 | else: | 68 | else: |
69 | cmd = command | 69 | cmd = command |
70 | XTerminal.__init__(self, cmd, title, env) | 70 | XTerminal.__init__(self, cmd, title, env, d) |
71 | 71 | ||
72 | class Konsole(XTerminal): | 72 | class Konsole(XTerminal): |
73 | command = 'konsole -T "{title}" -e {command}' | 73 | command = 'konsole -T "{title}" -e {command}' |
74 | priority = 2 | 74 | priority = 2 |
75 | 75 | ||
76 | def __init__(self, sh_cmd, title=None, env=None): | 76 | def __init__(self, sh_cmd, title=None, env=None, d=None): |
77 | # Check version | 77 | # Check version |
78 | vernum = check_konsole_version("konsole") | 78 | vernum = check_konsole_version("konsole") |
79 | if vernum: | 79 | if vernum: |
80 | if vernum.split('.')[0] == "2": | 80 | if vernum.split('.')[0] == "2": |
81 | logger.debug(1, 'Konsole from KDE 4.x will not work as devshell, skipping') | 81 | logger.debug(1, 'Konsole from KDE 4.x will not work as devshell, skipping') |
82 | raise UnsupportedTerminal(self.name) | 82 | raise UnsupportedTerminal(self.name) |
83 | XTerminal.__init__(self, sh_cmd, title, env) | 83 | XTerminal.__init__(self, sh_cmd, title, env, d) |
84 | 84 | ||
85 | class XTerm(XTerminal): | 85 | class XTerm(XTerminal): |
86 | command = 'xterm -T "{title}" -e {command}' | 86 | command = 'xterm -T "{title}" -e {command}' |
@@ -93,7 +93,7 @@ class Rxvt(XTerminal): | |||
93 | class Screen(Terminal): | 93 | class Screen(Terminal): |
94 | command = 'screen -D -m -t "{title}" -S devshell {command}' | 94 | command = 'screen -D -m -t "{title}" -S devshell {command}' |
95 | 95 | ||
96 | def __init__(self, sh_cmd, title=None, env=None): | 96 | def __init__(self, sh_cmd, title=None, env=None, d=None): |
97 | s_id = "devshell_%i" % os.getpid() | 97 | s_id = "devshell_%i" % os.getpid() |
98 | self.command = "screen -D -m -t \"{title}\" -S %s {command}" % s_id | 98 | self.command = "screen -D -m -t \"{title}\" -S %s {command}" % s_id |
99 | Terminal.__init__(self, sh_cmd, title, env) | 99 | Terminal.__init__(self, sh_cmd, title, env) |
@@ -104,18 +104,18 @@ class Screen(Terminal): | |||
104 | def prioritized(): | 104 | def prioritized(): |
105 | return Registry.prioritized() | 105 | return Registry.prioritized() |
106 | 106 | ||
107 | def spawn_preferred(sh_cmd, title=None, env=None): | 107 | def spawn_preferred(sh_cmd, title=None, env=None, d=None): |
108 | """Spawn the first supported terminal, by priority""" | 108 | """Spawn the first supported terminal, by priority""" |
109 | for terminal in prioritized(): | 109 | for terminal in prioritized(): |
110 | try: | 110 | try: |
111 | spawn(terminal.name, sh_cmd, title, env) | 111 | spawn(terminal.name, sh_cmd, title, env, d) |
112 | break | 112 | break |
113 | except UnsupportedTerminal: | 113 | except UnsupportedTerminal: |
114 | continue | 114 | continue |
115 | else: | 115 | else: |
116 | raise NoSupportedTerminals() | 116 | raise NoSupportedTerminals() |
117 | 117 | ||
118 | def spawn(name, sh_cmd, title=None, env=None): | 118 | def spawn(name, sh_cmd, title=None, env=None, d=None): |
119 | """Spawn the specified terminal, by name""" | 119 | """Spawn the specified terminal, by name""" |
120 | logger.debug(1, 'Attempting to spawn terminal "%s"', name) | 120 | logger.debug(1, 'Attempting to spawn terminal "%s"', name) |
121 | try: | 121 | try: |
@@ -123,7 +123,7 @@ def spawn(name, sh_cmd, title=None, env=None): | |||
123 | except KeyError: | 123 | except KeyError: |
124 | raise UnsupportedTerminal(name) | 124 | raise UnsupportedTerminal(name) |
125 | 125 | ||
126 | pipe = terminal(sh_cmd, title, env) | 126 | pipe = terminal(sh_cmd, title, env, d) |
127 | output = pipe.communicate()[0] | 127 | output = pipe.communicate()[0] |
128 | if pipe.returncode != 0: | 128 | if pipe.returncode != 0: |
129 | raise ExecutionError(sh_cmd, pipe.returncode, output) | 129 | raise ExecutionError(sh_cmd, pipe.returncode, output) |