diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2011-09-16 17:36:12 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-09-19 04:52:48 +0100 |
commit | 9b5175255b134d5d855234a44316a6a034a1f210 (patch) | |
tree | d8844f2d18aad6cd100e359c4e6b27ae6a1abc6c /meta/lib | |
parent | aed52479805b7a3d6721d3aa8e4195d2a41a57d7 (diff) | |
download | poky-9b5175255b134d5d855234a44316a6a034a1f210.tar.gz |
lib/oe/terminal.py: declare konsole from KDE 4.x as unsupported
Konsole 2.x (from KDE 4.x) does not work as devshell - it does not pass
the environment or current working directory through among other issues,
so do a version check and disable it if it is found (skipping to the
next available terminal application.)
(From OE-Core rev: ee57cd7deb778dc72e58668d8c71cf840a3bc0d9)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/terminal.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py index 3965462598..1455e8e719 100644 --- a/meta/lib/oe/terminal.py +++ b/meta/lib/oe/terminal.py | |||
@@ -61,6 +61,15 @@ class Konsole(XTerminal): | |||
61 | command = 'konsole -T "{title}" -e {command}' | 61 | command = 'konsole -T "{title}" -e {command}' |
62 | priority = 2 | 62 | priority = 2 |
63 | 63 | ||
64 | def __init__(self, command, title=None, env=None): | ||
65 | # Check version | ||
66 | vernum = check_konsole_version("konsole") | ||
67 | if vernum: | ||
68 | if vernum.split('.')[0] == "2": | ||
69 | logger.debug(1, 'Konsole from KDE 4.x will not work as devshell, skipping') | ||
70 | raise UnsupportedTerminal(self.name) | ||
71 | XTerminal.__init__(self, command, title, env) | ||
72 | |||
64 | class XTerm(XTerminal): | 73 | class XTerm(XTerminal): |
65 | command = 'xterm -T "{title}" -e {command}' | 74 | command = 'xterm -T "{title}" -e {command}' |
66 | priority = 1 | 75 | priority = 1 |
@@ -104,3 +113,21 @@ def spawn(name, command, title=None, env=None): | |||
104 | output = pipe.communicate()[0] | 113 | output = pipe.communicate()[0] |
105 | if pipe.returncode != 0: | 114 | if pipe.returncode != 0: |
106 | raise ExecutionError(pipe.command, pipe.returncode, output) | 115 | raise ExecutionError(pipe.command, pipe.returncode, output) |
116 | |||
117 | def check_konsole_version(konsole): | ||
118 | import subprocess as sub | ||
119 | try: | ||
120 | p = sub.Popen(['sh', '-c', '%s --version' % konsole],stdout=sub.PIPE,stderr=sub.PIPE) | ||
121 | out, err = p.communicate() | ||
122 | ver_info = out.rstrip().split('\n') | ||
123 | except OSError as exc: | ||
124 | import errno | ||
125 | if exc.errno == errno.ENOENT: | ||
126 | return None | ||
127 | else: | ||
128 | raise | ||
129 | vernum = None | ||
130 | for ver in ver_info: | ||
131 | if ver.startswith('Konsole'): | ||
132 | vernum = ver.split(' ')[-1] | ||
133 | return vernum | ||