diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-10-05 20:19:31 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-04 14:46:37 +0000 |
commit | f3406dd28846f4782bec36cb0bd1f834e068147b (patch) | |
tree | 32ad721ecc92b3bcf9ef0ec72911b16b767c02b0 /bitbake/lib/bb | |
parent | 6491ed9e2ee6562a9ffc548fdd9ee6e13ba96657 (diff) | |
download | openembedded-core-f3406dd28846f4782bec36cb0bd1f834e068147b.tar.gz openembedded-core-f3406dd28846f4782bec36cb0bd1f834e068147b.tar.bz2 openembedded-core-f3406dd28846f4782bec36cb0bd1f834e068147b.tar.xz openembedded-core-f3406dd28846f4782bec36cb0bd1f834e068147b.zip |
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')
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 7de90056d..17a642ee2 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py @@ -150,7 +150,7 @@ class DataSmart(MutableMapping): for var in vars: name = var[:-l] try: - self[name] = self[var] + self.setVar(name, self.getVar(var, False)) except Exception: logger.info("Untracked delVar") @@ -366,7 +366,11 @@ class DataSmart(MutableMapping): return len(frozenset(self)) def __getitem__(self, item): - return self.getVar(item, False) + value = self.getVar(item, False) + if value is None: + raise KeyError(item) + else: + return value def __setitem__(self, var, value): self.setVar(var, value) |