terminal.py: No --disable-factory for gnome-terminal >= 3.10
PATCH 1/1 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.
--- meta/lib/oe/terminal.py | 13 +++++++++++++ 1 file changed, 13 insertions(+)
meta/lib/oe/terminal.py +13 -0
@@ -55,6 +55,17 @@ class Gnome(XTerminal): command = 'gnome-terminal -t "{title}" --disable-factory -x {command}' priority = 2 + def __init__(self, sh_cmd, title=None, env=None, d=None): + # Check version + vernum = check_konsole_version("gnome-terminal") + if vernum: + major = int(vernum.split('.')[0]) + minor = int(vernum.split('.')[1]) + if major >= 3 and minor >= 10: + logger.warn(1, 'Gnome-Terminal >3.10 does not support --disable-factory') + self.command = 'gnome-terminal -t "{title}" -x {command}' + XTerminal.__init__(self, sh_cmd, title, env, d) + class Mate(XTerminal): command = 'mate-terminal -t "{title}" -x {command}' priority = 2
@@ -235,6 +246,8 @@ def check_konsole_version(konsole): for ver in ver_info: if ver.startswith('Konsole'): vernum = ver.split(' ')[-1] + if ver.startswith('GNOME Terminal'): + vernum = ver.split(' ')[-1] return vernum def distro_name():
Signature · 1 line
1.9.3
Hi Sven,
Review def check_konsole_version(konsole): · line 246
Quoted 2 lines · Sven Ebenfeld
(quoted diff) +0
-0@@ -235,6 +246,8 @@ def check_konsole_version(konsole):
Can you rename check_konsole_version to something generic such as check_terminal_version?
Cheers,
Ross
Hi again,
meta/lib/oe/terminal.py class Gnome(XTerminal): · line 63
Quoted 5 lines · Sven Ebenfeld
meta/lib/oe/terminal.py +4
-0+ vernum = check_konsole_version("gnome-terminal") + if vernum: + major = int(vernum.split('.')[0]) + minor = int(vernum.split('.')[1])
And whilst you're editing this code, doing the split inside check_terminal_version and returning a tuple would clean it up nicely:
def get_terminal_version():
...
return ver.split()[-1].split('.')[:2](major, minor) = get_terminal_version()
Ross
Hi Ross,
Thank you for your replies!
I've reworked my patch and submitted it again.
Cheers,
Sven
Am 23.02.2015 um 14:34 schrieb Burton, Ross:
Quoted 20 lines
Hi again,
meta/lib/oe/terminal.py class Gnome(XTerminal): · line 63
Quoted 5 lines · Sven Ebenfeld
meta/lib/oe/terminal.py +4
-0+ vernum = check_konsole_version("gnome-terminal") + if vernum: + major = int(vernum.split('.')[0]) + minor = int(vernum.split('.')[1])And whilst you're editing this code, doing the split inside
check_terminal_versionand returning a tuple would clean it up nicely:def
get_terminal_version():... return ver.split()[-1].split('.')[:2](major, minor) =
get_terminal_version()Ross