From 0090a798eb868ebc926944eac2e6d4a5aff3e1b3 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sat, 1 Jan 2011 23:55:54 +0000 Subject: bitbake: Sync a load of whitespace and other non-functionality changes with bitbake uptream Signed-off-by: Richard Purdie --- bitbake/lib/bb/data_smart.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'bitbake/lib/bb/data_smart.py') diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index ca72449b7..83e6f70cd 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py @@ -28,10 +28,10 @@ BitBake build tools. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Based on functions from the base bb module, Copyright 2003 Holger Schurig -import copy, re, sys +import copy, re from collections import MutableMapping import logging -import bb +import bb, bb.codeparser from bb import utils from bb.COW import COWDictBase @@ -42,6 +42,7 @@ __setvar_regexp__ = re.compile('(?P.*?)(?P_append|_prepend)(_(?P< __expand_var_regexp__ = re.compile(r"\${[^{}]+}") __expand_python_regexp__ = re.compile(r"\${@.+?}") + class VariableParse: def __init__(self, varname, d, val = None): self.varname = varname @@ -72,11 +73,11 @@ class VariableParse: self.references |= parser.references self.execs |= parser.execs - value = utils.better_eval(codeobj, DataDict(self.d)) + value = utils.better_eval(codeobj, DataContext(self.d)) return str(value) -class DataDict(dict): +class DataContext(dict): def __init__(self, metadata, **kwargs): self.metadata = metadata dict.__init__(self, **kwargs) @@ -129,7 +130,7 @@ class DataSmart(MutableMapping): def expand(self, s, varname): return self.expandWithRefs(s, varname).value - + def finalize(self): """Performs final steps upon the datastore, including application of overrides""" @@ -291,7 +292,7 @@ class DataSmart(MutableMapping): self._makeShadowCopy(var) self.dict[var][flag] = flagvalue - def getVarFlag(self, var, flag, expand = False): + def getVarFlag(self, var, flag, expand=False): local_var = self._findVar(var) value = None if local_var: @@ -374,7 +375,7 @@ class DataSmart(MutableMapping): value = self.getVar(variable, False) for key in keys: referrervalue = self.getVar(key, False) - if ref in referrervalue: + if referrervalue and ref in referrervalue: self.setVar(key, referrervalue.replace(ref, value)) def localkeys(self): -- cgit v1.2.3