lib/oe/terminal: fix regressions
Fix up some issues introduced by OE-Core commit 818c94f5b9882c2028ef9f056714a0a3c9045551: * If we want to support versions with more than two parts, versions with only one part, or versions with non-integer parts, then we have to stay with strings. We can use distutils.version.LooseVersion() to help with comparisons. * We don't want a warning when launching gnome-terminal 3.10+ and logger.warn() doesn't take a first integer parameter anyway (logger.debug() does). * Also clean up tabs. (From OE-Core rev: 565d4a144ab3b8fe04950392497de1e0cf1152a5) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
efd78e3508
commit
f160730bbd
|
@ -2,6 +2,7 @@ import logging
|
||||||
import oe.classutils
|
import oe.classutils
|
||||||
import shlex
|
import shlex
|
||||||
from bb.process import Popen, ExecutionError
|
from bb.process import Popen, ExecutionError
|
||||||
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
logger = logging.getLogger('BitBake.OE.Terminal')
|
logger = logging.getLogger('BitBake.OE.Terminal')
|
||||||
|
|
||||||
|
@ -57,9 +58,9 @@ class Gnome(XTerminal):
|
||||||
|
|
||||||
def __init__(self, sh_cmd, title=None, env=None, d=None):
|
def __init__(self, sh_cmd, title=None, env=None, d=None):
|
||||||
# Check version
|
# Check version
|
||||||
(major, minor) = check_terminal_version("gnome-terminal")
|
vernum = check_terminal_version("gnome-terminal")
|
||||||
if major >= 3 and minor >= 10:
|
if vernum and LooseVersion(vernum) >= '3.10':
|
||||||
logger.warn(1, 'Gnome-Terminal >3.10 does not support --disable-factory')
|
logger.debug(1, 'Gnome-Terminal 3.10 or later does not support --disable-factory')
|
||||||
self.command = 'gnome-terminal -t "{title}" -x {command}'
|
self.command = 'gnome-terminal -t "{title}" -x {command}'
|
||||||
XTerminal.__init__(self, sh_cmd, title, env, d)
|
XTerminal.__init__(self, sh_cmd, title, env, d)
|
||||||
|
|
||||||
|
@ -81,8 +82,8 @@ class Konsole(XTerminal):
|
||||||
|
|
||||||
def __init__(self, sh_cmd, title=None, env=None, d=None):
|
def __init__(self, sh_cmd, title=None, env=None, d=None):
|
||||||
# Check version
|
# Check version
|
||||||
(major, minor) = check_terminal_version("konsole")
|
vernum = check_terminal_version("konsole")
|
||||||
if major == 2:
|
if vernum and LooseVersion(vernum) >= '2.0.0':
|
||||||
logger.debug(1, 'Konsole from KDE 4.x will not work as devshell, skipping')
|
logger.debug(1, 'Konsole from KDE 4.x will not work as devshell, skipping')
|
||||||
raise UnsupportedTerminal(self.name)
|
raise UnsupportedTerminal(self.name)
|
||||||
XTerminal.__init__(self, sh_cmd, title, env, d)
|
XTerminal.__init__(self, sh_cmd, title, env, d)
|
||||||
|
@ -239,17 +240,12 @@ def check_terminal_version(terminalName):
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
vernum = None
|
vernum = None
|
||||||
major = int(0)
|
|
||||||
minor = int(0)
|
|
||||||
for ver in ver_info:
|
for ver in ver_info:
|
||||||
if ver.startswith('Konsole'):
|
if ver.startswith('Konsole'):
|
||||||
vernum = ver.split(' ')[-1]
|
vernum = ver.split(' ')[-1]
|
||||||
if ver.startswith('GNOME Terminal'):
|
if ver.startswith('GNOME Terminal'):
|
||||||
vernum = ver.split(' ')[-1]
|
vernum = ver.split(' ')[-1]
|
||||||
if vernum:
|
return vernum
|
||||||
major = int(vernum.split('.')[0])
|
|
||||||
minor = int(vernum.split('.')[1])
|
|
||||||
return major, minor
|
|
||||||
|
|
||||||
def distro_name():
|
def distro_name():
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue