summaryrefslogtreecommitdiffstats
path: root/lib/bb/data.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bb/data.py')
-rw-r--r--lib/bb/data.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/bb/data.py b/lib/bb/data.py
index 9782c9f54..21cdde04a 100644
--- a/lib/bb/data.py
+++ b/lib/bb/data.py
@@ -96,6 +96,19 @@ def getVar(var, d, exp = 0):
"""
return d.getVar(var,exp)
+
+def renameVar(key, newkey, d):
+ """Renames a variable from key to newkey
+
+ Example:
+ >>> d = init()
+ >>> setVar('TEST', 'testcontents', d)
+ >>> renameVar('TEST', 'TEST2', d)
+ >>> print getVar('TEST2', d)
+ testcontents
+ """
+ d.renameVar(key, newkey)
+
def delVar(var, d):
"""Removes a variable from the data set
@@ -276,20 +289,8 @@ def expandKeys(alterdata, readdata = None):
ekey = expand(key, readdata)
if key == ekey:
continue
- val = getVar(key, alterdata)
- if val is None:
- continue
-# import copy
-# setVarFlags(ekey, copy.copy(getVarFlags(key, readdata)), alterdata)
- setVar(ekey, val, alterdata)
-
- for i in ('_append', '_prepend'):
- dest = getVarFlag(ekey, i, alterdata) or []
- src = getVarFlag(key, i, readdata) or []
- dest.extend(src)
- setVarFlag(ekey, i, dest, alterdata)
- delVar(key, alterdata)
+ renameVar(key, ekey, alterdata)
def expandData(alterdata, readdata = None):
"""For each variable in alterdata, expand it, and update the var contents.