diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-02-25 11:22:24 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-02-26 07:47:50 +0000 |
commit | f160730bbdb06cca5c1443e6688365cffe6deb00 (patch) | |
tree | ddb839518daf472bfa2c3f92fd1578c0cb72e3c5 /meta/lib/oe | |
parent | efd78e35082ccf6164ae11f988378398d1295304 (diff) | |
download | poky-f160730bbdb06cca5c1443e6688365cffe6deb00.tar.gz |
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>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/terminal.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py index 01c0ccc334..fdfdde2f91 100644 --- a/meta/lib/oe/terminal.py +++ b/meta/lib/oe/terminal.py | |||
@@ -2,6 +2,7 @@ import logging | |||
2 | import oe.classutils | 2 | import oe.classutils |
3 | import shlex | 3 | import shlex |
4 | from bb.process import Popen, ExecutionError | 4 | from bb.process import Popen, ExecutionError |
5 | from distutils.version import LooseVersion | ||
5 | 6 | ||
6 | logger = logging.getLogger('BitBake.OE.Terminal') | 7 | logger = logging.getLogger('BitBake.OE.Terminal') |
7 | 8 | ||
@@ -57,9 +58,9 @@ class Gnome(XTerminal): | |||
57 | 58 | ||
58 | def __init__(self, sh_cmd, title=None, env=None, d=None): | 59 | def __init__(self, sh_cmd, title=None, env=None, d=None): |
59 | # Check version | 60 | # Check version |
60 | (major, minor) = check_terminal_version("gnome-terminal") | 61 | vernum = check_terminal_version("gnome-terminal") |
61 | if major >= 3 and minor >= 10: | 62 | if vernum and LooseVersion(vernum) >= '3.10': |
62 | logger.warn(1, 'Gnome-Terminal >3.10 does not support --disable-factory') | 63 | logger.debug(1, 'Gnome-Terminal 3.10 or later does not support --disable-factory') |
63 | self.command = 'gnome-terminal -t "{title}" -x {command}' | 64 | self.command = 'gnome-terminal -t "{title}" -x {command}' |
64 | XTerminal.__init__(self, sh_cmd, title, env, d) | 65 | XTerminal.__init__(self, sh_cmd, title, env, d) |
65 | 66 | ||
@@ -81,8 +82,8 @@ class Konsole(XTerminal): | |||
81 | 82 | ||
82 | def __init__(self, sh_cmd, title=None, env=None, d=None): | 83 | def __init__(self, sh_cmd, title=None, env=None, d=None): |
83 | # Check version | 84 | # Check version |
84 | (major, minor) = check_terminal_version("konsole") | 85 | vernum = check_terminal_version("konsole") |
85 | if major == 2: | 86 | if vernum and LooseVersion(vernum) >= '2.0.0': |
86 | logger.debug(1, 'Konsole from KDE 4.x will not work as devshell, skipping') | 87 | logger.debug(1, 'Konsole from KDE 4.x will not work as devshell, skipping') |
87 | raise UnsupportedTerminal(self.name) | 88 | raise UnsupportedTerminal(self.name) |
88 | XTerminal.__init__(self, sh_cmd, title, env, d) | 89 | XTerminal.__init__(self, sh_cmd, title, env, d) |
@@ -239,17 +240,12 @@ def check_terminal_version(terminalName): | |||
239 | else: | 240 | else: |
240 | raise | 241 | raise |
241 | vernum = None | 242 | vernum = None |
242 | major = int(0) | ||
243 | minor = int(0) | ||
244 | for ver in ver_info: | 243 | for ver in ver_info: |
245 | if ver.startswith('Konsole'): | 244 | if ver.startswith('Konsole'): |
246 | vernum = ver.split(' ')[-1] | 245 | vernum = ver.split(' ')[-1] |
247 | if ver.startswith('GNOME Terminal'): | 246 | if ver.startswith('GNOME Terminal'): |
248 | vernum = ver.split(' ')[-1] | 247 | vernum = ver.split(' ')[-1] |
249 | if vernum: | 248 | return vernum |
250 | major = int(vernum.split('.')[0]) | ||
251 | minor = int(vernum.split('.')[1]) | ||
252 | return major, minor | ||
253 | 249 | ||
254 | def distro_name(): | 250 | def distro_name(): |
255 | try: | 251 | try: |