]> code.ossystems Code Review - openembedded-core.git/commitdiff
lib/oeqa/utils/commands.py: Move updateEnv() from runexported.py
authorMariano Lopez <mariano.lopez@linux.intel.com>
Thu, 7 Jul 2016 14:48:55 +0000 (14:48 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 20 Jul 2016 10:08:16 +0000 (11:08 +0100)
updateEnv() can be used in other places so move the
function to utils/commands.py

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/runexported.py
meta/lib/oeqa/utils/commands.py

index 58867393bb7e55a0fbf928192285861e3592d7ca..125e86d0e6d5c67cb05cf060d3e5d1f4020645b5 100755 (executable)
@@ -31,7 +31,7 @@ except ImportError:
 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "oeqa")))
 
 from oeqa.oetest import ExportTestContext
-from oeqa.utils.commands import runCmd
+from oeqa.utils.commands import runCmd, updateEnv
 from oeqa.utils.sshcontrol import SSHControl
 
 # this isn't pretty but we need a fake target object
@@ -137,19 +137,7 @@ def extract_sdk(d):
             if f.startswith("environment-setup"):
                 print("Setting up SDK environment...")
                 env_file = os.path.join(extract_path, f)
-                update_env(env_file)
-
-def update_env(env_file):
-    """
-    Source a file and update environment
-    """
-
-    cmd = ". %s; env -0" % env_file
-    result = runCmd(cmd)
-
-    for line in result.output.split("\0"):
-        (key, _, value) = line.partition("=")
-        os.environ[key] = value
+                updateEnv(env_file)
 
 if __name__ == "__main__":
     try:
index 418643a1a62cf3e0e8401d1d240f53e1200a9b80..4f79d15bb8efc2e331d1ee664eeb0d5d64a955b3 100644 (file)
@@ -261,3 +261,15 @@ def runqemu(pn, ssh=True):
             qemu.stop()
         except:
             pass
+
+def updateEnv(env_file):
+    """
+    Source a file and update environment.
+    """
+
+    cmd = ". %s; env -0" % env_file
+    result = runCmd(cmd)
+
+    for line in result.output.split("\0"):
+        (key, _, value) = line.partition("=")
+        os.environ[key] = value