diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2007-08-15 22:57:25 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2007-08-15 22:57:25 +0000 |
commit | 9388498f080a084ed56a7f94d642a8520bfdcfe2 (patch) | |
tree | 1672bb43268c957dac779db5fcdd9d462c26ea05 /lib/bb/data_smart.py | |
parent | 71486b49624ed785c85b4800fc034719c554ebd9 (diff) | |
download | bitbake-9388498f080a084ed56a7f94d642a8520bfdcfe2.tar.gz |
data/data_smart.py: Add data.renameVar()
Diffstat (limited to 'lib/bb/data_smart.py')
-rw-r--r-- | lib/bb/data_smart.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py index ef1e9dda0..836df50fb 100644 --- a/lib/bb/data_smart.py +++ b/lib/bb/data_smart.py @@ -170,6 +170,28 @@ class DataSmart: return self.expand(value,var) return value + def renameVar(self, key, newkey): + """ + Rename the variable key to newkey + """ + val = self.getVar(key, 0) + if val is None: + return + + self.setVar(newkey, val) + + for i in ('_append', '_prepend'): + dest = self.getVarFlag(newkey, i) or [] + src = self.getVarFlag(key, i) or [] + dest.extend(src) + self.setVarFlag(newkey, i, dest) + + if key in self._special_values[i]: + self._special_values[i].remove(key) + self._special_values[i].add(newkey) + + self.delVar(key) + def delVar(self,var): self.expand_cache = {} self.dict[var] = {} |