summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/terminal.py
diff options
context:
space:
mode:
authorSven Ebenfeld <sven.ebenfeld@gmail.com>2015-02-23 20:39:41 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-24 23:34:19 +0000
commit43afafeffa85d6268a8346e9feb542385183a5cf (patch)
treeda8d57f9f0e19a59b69a02f0c0624c42e96dda20 /meta/lib/oe/terminal.py
parent9e9d6dfbd26742ea59383e268c7a4e9eb18456bf (diff)
downloadpoky-43afafeffa85d6268a8346e9feb542385183a5cf.tar.gz
terminal.py: No --disable-factory for gnome-terminal >= 3.10
--disable-factory has been disabled in earlier versions of gnome-terminal but from version 3.10 it raises an error and quits. This makes devshell unusable with gnome-terminal >= 3.10. This patch checks for the version and removes --disable-factory if you have the terminal version 3.10 or higher. (From OE-Core rev: 818c94f5b9882c2028ef9f056714a0a3c9045551) Signed-off-by: Sven Ebenfeld <sven.ebenfeld@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/terminal.py')
-rw-r--r--meta/lib/oe/terminal.py30
1 files changed, 22 insertions, 8 deletions
diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index 54e3ffc1e8..01c0ccc334 100644
--- a/meta/lib/oe/terminal.py
+++ b/meta/lib/oe/terminal.py
@@ -55,6 +55,14 @@ class Gnome(XTerminal):
55 command = 'gnome-terminal -t "{title}" --disable-factory -x {command}' 55 command = 'gnome-terminal -t "{title}" --disable-factory -x {command}'
56 priority = 2 56 priority = 2
57 57
58 def __init__(self, sh_cmd, title=None, env=None, d=None):
59 # Check version
60 (major, minor) = check_terminal_version("gnome-terminal")
61 if major >= 3 and minor >= 10:
62 logger.warn(1, 'Gnome-Terminal >3.10 does not support --disable-factory')
63 self.command = 'gnome-terminal -t "{title}" -x {command}'
64 XTerminal.__init__(self, sh_cmd, title, env, d)
65
58class Mate(XTerminal): 66class Mate(XTerminal):
59 command = 'mate-terminal -t "{title}" -x {command}' 67 command = 'mate-terminal -t "{title}" -x {command}'
60 priority = 2 68 priority = 2
@@ -73,11 +81,10 @@ class Konsole(XTerminal):
73 81
74 def __init__(self, sh_cmd, title=None, env=None, d=None): 82 def __init__(self, sh_cmd, title=None, env=None, d=None):
75 # Check version 83 # Check version
76 vernum = check_konsole_version("konsole") 84 (major, minor) = check_terminal_version("konsole")
77 if vernum: 85 if major == 2:
78 if vernum.split('.')[0] == "2": 86 logger.debug(1, 'Konsole from KDE 4.x will not work as devshell, skipping')
79 logger.debug(1, 'Konsole from KDE 4.x will not work as devshell, skipping') 87 raise UnsupportedTerminal(self.name)
80 raise UnsupportedTerminal(self.name)
81 XTerminal.__init__(self, sh_cmd, title, env, d) 88 XTerminal.__init__(self, sh_cmd, title, env, d)
82 89
83class XTerm(XTerminal): 90class XTerm(XTerminal):
@@ -219,10 +226,10 @@ def check_tmux_pane_size(tmux):
219 return True 226 return True
220 return False 227 return False
221 228
222def check_konsole_version(konsole): 229def check_terminal_version(terminalName):
223 import subprocess as sub 230 import subprocess as sub
224 try: 231 try:
225 p = sub.Popen(['sh', '-c', '%s --version' % konsole],stdout=sub.PIPE,stderr=sub.PIPE) 232 p = sub.Popen(['sh', '-c', '%s --version' % terminalName],stdout=sub.PIPE,stderr=sub.PIPE)
226 out, err = p.communicate() 233 out, err = p.communicate()
227 ver_info = out.rstrip().split('\n') 234 ver_info = out.rstrip().split('\n')
228 except OSError as exc: 235 except OSError as exc:
@@ -232,10 +239,17 @@ def check_konsole_version(konsole):
232 else: 239 else:
233 raise 240 raise
234 vernum = None 241 vernum = None
242 major = int(0)
243 minor = int(0)
235 for ver in ver_info: 244 for ver in ver_info:
236 if ver.startswith('Konsole'): 245 if ver.startswith('Konsole'):
237 vernum = ver.split(' ')[-1] 246 vernum = ver.split(' ')[-1]
238 return vernum 247 if ver.startswith('GNOME Terminal'):
248 vernum = ver.split(' ')[-1]
249 if vernum:
250 major = int(vernum.split('.')[0])
251 minor = int(vernum.split('.')[1])
252 return major, minor
239 253
240def distro_name(): 254def distro_name():
241 try: 255 try: