All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Juro Bystricky <juro.bystricky@intel.com>,
	openembedded-core@lists.openembedded.org
Cc: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: Re: [PATCH] build.py: fix os.getcwd() exception
Date: Tue, 27 Sep 2016 13:25:46 +0100	[thread overview]
Message-ID: <1474979146.30475.19.camel@linuxfoundation.org> (raw)
In-Reply-To: <1474923193-25918-1-git-send-email-juro.bystricky@intel.com>

On Mon, 2016-09-26 at 13:53 -0700, Juro Bystricky wrote:
> When trying to obtain the current directory from a directory
> that does not exist anymore, an exception is raised.
> This patch handles such exception.

This should have gone to bitbake-devel, I've cc'd there and queued in
master-next for testing.

Cheers,

Richard

> [YOCTO #10331]
> 
> Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
> ---
>  bitbake/lib/bb/build.py | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
> index 2ed0441..249f7d6 100644
> --- a/bitbake/lib/bb/build.py
> +++ b/bitbake/lib/bb/build.py
> @@ -261,9 +261,14 @@ def exec_func(func, d, dirs = None,
> pythonexception=False):
>          else:
>              exec_func_shell(func, d, runfile, cwd=adir)
>  
> -    if oldcwd and os.getcwd() != oldcwd:
> +    try:
> +        curcwd = os.getcwd()
> +    except:
> +        curcwd = None
> +
> +    if oldcwd and curcwd != oldcwd:
>          try:
> -            bb.warn("Task %s changed cwd to %s" % (func,
> os.getcwd()))
> +            bb.warn("Task %s changed cwd to %s" % (func, curcwd))
>              os.chdir(oldcwd)
>          except:
>              pass


      reply	other threads:[~2016-09-27 12:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-26 20:53 [PATCH] build.py: fix os.getcwd() exception Juro Bystricky
2016-09-27 12:25 ` Richard Purdie [this message]

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=1474979146.30475.19.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=juro.bystricky@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.