From 7be82bf66524c9c78ddf798131d1cb38489a14c1 Mon Sep 17 00:00:00 2001 From: Christopher Larson Date: Thu, 17 Mar 2022 15:29:52 -0700 Subject: bitbake: data_smart: directly check for methodpool functions in context lookup We previously checked for the existence of the 'func' flag to determine if we should avoid looking up in the metadata. This was done to ensure the user gets the function for 'def' python functions rather than their string contents. We can sidestep the metadata lookup and check our function context directly, instead. (Bitbake rev: 6cac1eac51efa9a54e8457f60ea1ea0e604c50b7) Signed-off-by: Christopher Larson Signed-off-by: Richard Purdie --- bitbake/lib/bb/data_smart.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'bitbake/lib/bb/data_smart.py') diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index fe0bacd13b..0128a5bb17 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py @@ -154,19 +154,20 @@ class VariableParse: return str(value) class DataContext(dict): - excluded = set([i for i in dir(builtins) if not i.startswith('_')] + ['bb', 'os', 'oe']) + excluded = set([i for i in dir(builtins) if not i.startswith('_')] + ['oe']) def __init__(self, metadata, **kwargs): self.metadata = metadata dict.__init__(self, **kwargs) self['d'] = metadata + self.context = set(bb.utils.get_context()) def __missing__(self, key): - if key in self.excluded: + if key in self.excluded or key in self.context: raise KeyError(key) value = self.metadata.getVar(key) - if value is None or self.metadata.getVarFlag(key, 'func', False): + if value is None: raise KeyError(key) else: return value -- cgit v1.2.3-54-g00ecf