bitbake: build.py: avoid exception when function is not defined
exc_func() fails with a hard to debug exception when the function does not exist, for example due to a typo: ERROR: ...: Traceback (most recent call last): File "/work/bitbake/lib/bb/build.py", line 644, in exec_task return _exec_task(fn, task, d, quieterr) File "/work/bitbake/lib/bb/build.py", line 584, in _exec_task exec_func(func, localdata) File "/work/bitbake/lib/bb/build.py", line 198, in exec_func cleandirs = flags.get('cleandirs') AttributeError: 'NoneType' object has no attribute 'get' There is code further down which will print a warning, but we don't reach that unless we allow None as result of of d.getVarFlags() first. The warning is further down intentionally and has to stay there, to ensure that 'cleandirs' gets executed also for empty functions. (Bitbake rev: 25df3db5eeda9dbf417e67e96845f376e5c8e6b3) Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
8147b84777
commit
478644aedf
|
@ -195,13 +195,13 @@ def exec_func(func, d, dirs = None, pythonexception=False):
|
||||||
oldcwd = None
|
oldcwd = None
|
||||||
|
|
||||||
flags = d.getVarFlags(func)
|
flags = d.getVarFlags(func)
|
||||||
cleandirs = flags.get('cleandirs')
|
cleandirs = flags.get('cleandirs') if flags else None
|
||||||
if cleandirs:
|
if cleandirs:
|
||||||
for cdir in d.expand(cleandirs).split():
|
for cdir in d.expand(cleandirs).split():
|
||||||
bb.utils.remove(cdir, True)
|
bb.utils.remove(cdir, True)
|
||||||
bb.utils.mkdirhier(cdir)
|
bb.utils.mkdirhier(cdir)
|
||||||
|
|
||||||
if dirs is None:
|
if flags and dirs is None:
|
||||||
dirs = flags.get('dirs')
|
dirs = flags.get('dirs')
|
||||||
if dirs:
|
if dirs:
|
||||||
dirs = d.expand(dirs).split()
|
dirs = d.expand(dirs).split()
|
||||||
|
|
Loading…
Reference in New Issue