]> code.ossystems Code Review - openembedded-core.git/commitdiff
lib/oe/terminal.py: declare konsole from KDE 4.x as unsupported
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Fri, 16 Sep 2011 16:36:12 +0000 (17:36 +0100)
committerSaul Wold <sgw@linux.intel.com>
Sun, 18 Sep 2011 22:58:58 +0000 (15:58 -0700)
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.)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
meta/lib/oe/terminal.py

index 3965462598a274f29cea5997b8de8ac9e5a87900..1455e8e719b0a82fa851dce98ca10352532510f2 100644 (file)
@@ -61,6 +61,15 @@ class Konsole(XTerminal):
     command = 'konsole -T "{title}" -e {command}'
     priority = 2
 
+    def __init__(self, command, title=None, env=None):
+        # Check version
+        vernum = check_konsole_version("konsole")
+        if vernum:
+            if vernum.split('.')[0] == "2":
+                logger.debug(1, 'Konsole from KDE 4.x will not work as devshell, skipping')
+                raise UnsupportedTerminal(self.name)
+        XTerminal.__init__(self, command, title, env)
+
 class XTerm(XTerminal):
     command = 'xterm -T "{title}" -e {command}'
     priority = 1
@@ -104,3 +113,21 @@ def spawn(name, command, title=None, env=None):
     output = pipe.communicate()[0]
     if pipe.returncode != 0:
         raise ExecutionError(pipe.command, pipe.returncode, output)
+
+def check_konsole_version(konsole):
+    import subprocess as sub
+    try:
+        p = sub.Popen(['sh', '-c', '%s --version' % konsole],stdout=sub.PIPE,stderr=sub.PIPE)
+        out, err = p.communicate()
+        ver_info = out.rstrip().split('\n')
+    except OSError as exc:
+        import errno
+        if exc.errno == errno.ENOENT:
+            return None
+        else:
+            raise
+    vernum = None
+    for ver in ver_info:
+        if ver.startswith('Konsole'):
+            vernum = ver.split(' ')[-1]
+    return vernum