From: Richard Purdie Date: Thu, 23 Jul 2009 16:46:20 +0000 (+0100) Subject: utils.py: Add build_environment function (from Poky) X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=720df03c5c45810d8ef89a8dbca6edb9301ca262;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git utils.py: Add build_environment function (from Poky) Add a function to bring the command environment in sync with the data dictonary. Signed-off-by: Richard Purdie --- diff --git a/lib/bb/utils.py b/lib/bb/utils.py index 230e06ab953..603c926422a 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -381,6 +381,16 @@ def empty_environment(): os.unsetenv(s) del os.environ[s] +def build_environment(d): + """ + Build an environment from all exported variables. + """ + import bb + for var in bb.data.keys(d): + export = bb.data.getVarFlag(var, "export", d) + if export: + os.environ[var] = bb.data.getVar(var, d, True) + def prunedir(topdir): # Delete everything reachable from the directory named in 'topdir'. # CAUTION: This is dangerous!