bb.{cooker, data}: only emit a var as python if 'func' is set
PATCH 1/1 bb.{cooker, data}: only emit a var as python if 'func' is set
From: Christopher Larson <[email protected]>
This avoids a common issue where PACKAGECONFIG is emitted as a function in bitbake -e when the 'python' flag exists. It isn't a python function unless both 'func' and 'python' are set. This aligns with the behavior of emit_func_python.
Signed-off-by Christopher Larson <[email protected]>
--- lib/bb/cooker.py | 2 +- lib/bb/data.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
lib/bb/cooker.py +1 -1
@@ -656,7 +656,7 @@ class BBCooker: # emit the metadata which isnt valid shell data.expandKeys(envdata) for e in envdata.keys(): - if data.getVarFlag( e, 'python', envdata ): + if envdata.getVarFlag(e, 'func', False) and envdata.getVarFlag(e, 'python', False): logger.plain("\npython %s () {\n%s}\n", e, envdata.getVar(e, False))
lib/bb/data.py +2 -2
@@ -182,12 +182,12 @@ def inheritFromOS(d, savedenv, permitted): def emit_var(var, o=sys.__stdout__, d = init(), all=False): """Emit a variable to be sourced by a shell.""" - if d.getVarFlag(var, "python", False): + func = d.getVarFlag(var, "func", False) + if d.getVarFlag(var, 'python', False) and func: return False export = d.getVarFlag(var, "export", False) unexport = d.getVarFlag(var, "unexport", False) - func = d.getVarFlag(var, "func", False) if not all and not export and not unexport and not func: return False
Signature · 1 line
2.8.0