[bitbake-devel] [RFC PATCH 1/1] lib/bb: preserve a copy of the initial environment variables

Joshua Lock josh at linux.intel.com
Mon Jul 18 22:33:17 UTC 2011


We are gradually introducing code which wants to be able to modify the
initial environment of BitBake. The os.environ map is created on first
import of the os module so create a copy early on and store it for future
use.

Signed-off-by: Joshua Lock <josh at linux.intel.com>
---
 lib/bb/__init__.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/bb/__init__.py b/lib/bb/__init__.py
index d20267b..414e836 100644
--- a/lib/bb/__init__.py
+++ b/lib/bb/__init__.py
@@ -30,6 +30,10 @@ if sys.version_info < (2, 6, 0):
 import os
 import logging
 
+# The os.environ map of the environment is captured the first time the os
+# module is imported. Take a copy so we can preserve the original environment
+# for later use.
+initial_environ = os.environ.copy()
 
 class NullHandler(logging.Handler):
     def emit(self, record):
-- 
1.7.6





More information about the bitbake-devel mailing list