* [PATCH] build.py: fix os.getcwd() exception
@ 2016-09-26 20:53 Juro Bystricky
2016-09-27 12:25 ` Richard Purdie
0 siblings, 1 reply; 2+ messages in thread
From: Juro Bystricky @ 2016-09-26 20:53 UTC (permalink / raw)
To: openembedded-core
When trying to obtain the current directory from a directory
that does not exist anymore, an exception is raised.
This patch handles such exception.
[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
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] build.py: fix os.getcwd() exception
2016-09-26 20:53 [PATCH] build.py: fix os.getcwd() exception Juro Bystricky
@ 2016-09-27 12:25 ` Richard Purdie
0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2016-09-27 12:25 UTC (permalink / raw)
To: Juro Bystricky, openembedded-core; +Cc: bitbake-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-27 12:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-26 20:53 [PATCH] build.py: fix os.getcwd() exception Juro Bystricky
2016-09-27 12:25 ` Richard Purdie
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.