Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Joshua Lock <josh@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 1/2] lib/oe/terminal.py: declare konsole from KDE 4.x as unsupported
Date: Fri, 16 Sep 2011 10:29:32 -0700	[thread overview]
Message-ID: <1316194174.2325.3.camel@scimitar> (raw)
In-Reply-To: <d281634d8b836e626c989fe781a87971824ff186.1316192786.git.paul.eggleton@linux.intel.com>

On Fri, 2011-09-16 at 18:08 +0100, Paul Eggleton wrote:
> 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.)

Thanks for fixing this!

> 
> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>

Signed-off-by: Joshua Lock <josh@linux.intel.com>

> ---
>  meta/lib/oe/terminal.py |   27 +++++++++++++++++++++++++++
>  1 files changed, 27 insertions(+), 0 deletions(-)
> 
> diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
> index 3965462..1455e8e 100644
> --- a/meta/lib/oe/terminal.py
> +++ b/meta/lib/oe/terminal.py
> @@ -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

-- 
Joshua Lock
        Yocto Project "Johannes factotum"
        Intel Open Source Technology Centre




  reply	other threads:[~2011-09-16 17:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-16 17:08 [PATCH 0/2] Konsole handling Paul Eggleton
2011-09-16 17:08 ` [PATCH 1/2] lib/oe/terminal.py: declare konsole from KDE 4.x as unsupported Paul Eggleton
2011-09-16 17:29   ` Joshua Lock [this message]
2011-09-16 17:08 ` [PATCH 2/2] sanity.bbclass: add a sanity check for KDE 4.x konsole in TERMCMD Paul Eggleton
2011-09-16 17:28   ` Joshua Lock
2011-09-19 16:21 ` [PATCH 0/2] Konsole handling Saul Wold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1316194174.2325.3.camel@scimitar \
    --to=josh@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox