diff options
| -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 | ||
