summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/data_smart.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-10-05 20:19:31 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:37 +0000
commitf3406dd28846f4782bec36cb0bd1f834e068147b (patch)
tree32ad721ecc92b3bcf9ef0ec72911b16b767c02b0 /bitbake/lib/bb/data_smart.py
parent6491ed9e2ee6562a9ffc548fdd9ee6e13ba96657 (diff)
downloadpoky-f3406dd28846f4782bec36cb0bd1f834e068147b.tar.gz
Fix __getitem__ for DataSmart
Ensure it raises KeyError for a missing key, this is required to use this as a mapping in various places, e.g. as locals in an eval. (Bitbake rev: 8d661ce0c303e8d69f17c1d095545d5ed086d1d5) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/data_smart.py')
-rw-r--r--bitbake/lib/bb/data_smart.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 7de90056d5..17a642ee2d 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -150,7 +150,7 @@ class DataSmart(MutableMapping):
150 for var in vars: 150 for var in vars:
151 name = var[:-l] 151 name = var[:-l]
152 try: 152 try:
153 self[name] = self[var] 153 self.setVar(name, self.getVar(var, False))
154 except Exception: 154 except Exception:
155 logger.info("Untracked delVar") 155 logger.info("Untracked delVar")
156 156
@@ -366,7 +366,11 @@ class DataSmart(MutableMapping):
366 return len(frozenset(self)) 366 return len(frozenset(self))
367 367
368 def __getitem__(self, item): 368 def __getitem__(self, item):
369 return self.getVar(item, False) 369 value = self.getVar(item, False)
370 if value is None:
371 raise KeyError(item)
372 else:
373 return value
370 374
371 def __setitem__(self, var, value): 375 def __setitem__(self, var, value):
372 self.setVar(var, value) 376 self.setVar(var, value)