aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Larson <kergoth@gmail.com>2022-03-17 15:29:52 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-08-04 11:36:44 +0100
commit6cac1eac51efa9a54e8457f60ea1ea0e604c50b7 (patch)
tree35400e570e2a397da288654575d68a8551673e36
parente9150447738a48f772240874b3512b08e982b19b (diff)
downloadbitbake-contrib-6cac1eac51efa9a54e8457f60ea1ea0e604c50b7.tar.gz
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. Signed-off-by: Christopher Larson <kergoth@gmail.com>
-rw-r--r--lib/bb/data_smart.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index fe0bacd13..0128a5bb1 100644
--- a/lib/bb/data_smart.py
+++ b/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