@@ -254,10 +254,11 @@ def get_bb_env(target=None, postconfig=None):
return bitbake("-e", postconfig=postconfig).output
def get_bb_vars(variables=None, target=None, postconfig=None):
- """Get values of multiple bitbake variables
+ """Get values of multiple bitbake variables or variable flags
- All values are read with a single tinfoil session. If variables is None,
- all variables are returned. Unset or empty values are returned as None.
+ All values are read with a single tinfoil session. Variable flags can be
+ requested with the VAR[flag] syntax. If variables is None, all variables
+ are returned. Unset or empty values are returned as None.
"""
import bb.tinfoil
@@ -282,8 +283,13 @@ def get_bb_vars(variables=None, target=None, postconfig=None):
values[var] = str(val)
return values
+ flag_re = re.compile(r'^(?P<var>[^\[]+)\[(?P<flag>[^\]]+)\]$')
for var in variables:
- val = d.getVar(var)
+ match = flag_re.match(var)
+ if match:
+ val = d.getVarFlag(match.group('var'), match.group('flag'))
+ else:
+ val = d.getVar(var)
values[var] = str(val) if val is not None and val != '' else None
return values