summaryrefslogtreecommitdiffstats
path: root/bitbake
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:37:56 +0100
commit7be82bf66524c9c78ddf798131d1cb38489a14c1 (patch)
tree2ad2ace66f4d9d5301a7cef2b77ba81b847dc281 /bitbake
parent042b70da3b4166bd240265f4e5ab242a439755de (diff)
downloadpoky-7be82bf66524c9c78ddf798131d1cb38489a14c1.tar.gz
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 <kergoth@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/data_smart.py7
1 files changed, 4 insertions, 3 deletions
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:
154 return str(value) 154 return str(value)
155 155
156class DataContext(dict): 156class DataContext(dict):
157 excluded = set([i for i in dir(builtins) if not i.startswith('_')] + ['bb', 'os', 'oe']) 157 excluded = set([i for i in dir(builtins) if not i.startswith('_')] + ['oe'])
158 158
159 def __init__(self, metadata, **kwargs): 159 def __init__(self, metadata, **kwargs):
160 self.metadata = metadata 160 self.metadata = metadata
161 dict.__init__(self, **kwargs) 161 dict.__init__(self, **kwargs)
162 self['d'] = metadata 162 self['d'] = metadata
163 self.context = set(bb.utils.get_context())
163 164
164 def __missing__(self, key): 165 def __missing__(self, key):
165 if key in self.excluded: 166 if key in self.excluded or key in self.context:
166 raise KeyError(key) 167 raise KeyError(key)
167 168
168 value = self.metadata.getVar(key) 169 value = self.metadata.getVar(key)
169 if value is None or self.metadata.getVarFlag(key, 'func', False): 170 if value is None:
170 raise KeyError(key) 171 raise KeyError(key)
171 else: 172 else:
172 return value 173 return value