[oe-commits] [openembedded-core] 01/15: lib/oeqa/utils/commands.py: Move updateEnv() from runexported.py

git at git.openembedded.org git at git.openembedded.org
Wed Jul 20 10:14:39 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 380e5d80898cac4ffc9715b3f597d0b62a0643ff
Author: Mariano Lopez <mariano.lopez at linux.intel.com>
AuthorDate: Thu Jul 7 14:48:55 2016 +0000

    lib/oeqa/utils/commands.py: Move updateEnv() from runexported.py
    
    updateEnv() can be used in other places so move the
    function to utils/commands.py
    
    Signed-off-by: Mariano Lopez <mariano.lopez at linux.intel.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/lib/oeqa/runexported.py    | 16 ++--------------
 meta/lib/oeqa/utils/commands.py | 12 ++++++++++++
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/meta/lib/oeqa/runexported.py b/meta/lib/oeqa/runexported.py
index 5886739..125e86d 100755
--- a/meta/lib/oeqa/runexported.py
+++ b/meta/lib/oeqa/runexported.py
@@ -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:
diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 418643a..4f79d15 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -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

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list