[oe-commits] [openembedded-core] 27/35: wic: use find_executable in favor of bb.utils.which

git at git.openembedded.org git at git.openembedded.org
Sat May 14 06:27:50 UTC 2016


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

commit 9658956bf8a5da779e06f71941de9b3e89415cdc
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Wed May 4 16:06:23 2016 +0300

    wic: use find_executable in favor of bb.utils.which
    
    As bitbake is not ported to Python 3 yet it's better to
    avoid using its APIs as much as possible to be able to
    test wic under Python 3 at least partially.
    
    Used distutils.spawn.find_executable API in favor of
    bb.utils.which to get path of the command to run.
    
    Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 scripts/lib/wic/utils/oe/misc.py | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py
index 11209be..0854dfb 100644
--- a/scripts/lib/wic/utils/oe/misc.py
+++ b/scripts/lib/wic/utils/oe/misc.py
@@ -28,6 +28,7 @@
 
 import os
 from collections import defaultdict
+from distutils import spawn
 
 from wic import msger
 from wic.utils import runner
@@ -83,13 +84,6 @@ def exec_cmd(cmd_and_args, as_shell=False, catch=3):
 
     return out
 
-def cmd_in_path(cmd, path):
-    import scriptpath
-
-    scriptpath.add_bitbake_lib_path()
-
-    return bb.utils.which(path, cmd) != "" or False
-
 def exec_native_cmd(cmd_and_args, native_sysroot, catch=3, pseudo=""):
     """
     Execute native command, catching stderr, stdout
@@ -112,7 +106,7 @@ def exec_native_cmd(cmd_and_args, native_sysroot, catch=3, pseudo=""):
     msger.debug("exec_native_cmd: %s" % cmd_and_args)
 
     # If the command isn't in the native sysroot say we failed.
-    if cmd_in_path(args[0], native_paths):
+    if spawn.find_executable(args[0], native_paths):
         ret, out = _exec_cmd(native_cmd_and_args, True, catch)
     else:
         ret = 127

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


More information about the Openembedded-commits mailing list