diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-05-04 16:06:23 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-14 23:05:14 +0100 |
commit | bc89dc4225904692882888bbe8feaee6e9c46120 (patch) | |
tree | 128f11579d879df4863574cb8e18804901a47f0d /scripts/lib/wic | |
parent | b6b5b5e29531be4eb77f1756b78a7b9a5292bcb4 (diff) | |
download | poky-bc89dc4225904692882888bbe8feaee6e9c46120.tar.gz |
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.
(From OE-Core rev: 9658956bf8a5da779e06f71941de9b3e89415cdc)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic')
-rw-r--r-- | scripts/lib/wic/utils/oe/misc.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py index 11209be58e..0854dfbac1 100644 --- a/scripts/lib/wic/utils/oe/misc.py +++ b/scripts/lib/wic/utils/oe/misc.py | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | import os | 29 | import os |
30 | from collections import defaultdict | 30 | from collections import defaultdict |
31 | from distutils import spawn | ||
31 | 32 | ||
32 | from wic import msger | 33 | from wic import msger |
33 | from wic.utils import runner | 34 | from wic.utils import runner |
@@ -83,13 +84,6 @@ def exec_cmd(cmd_and_args, as_shell=False, catch=3): | |||
83 | 84 | ||
84 | return out | 85 | return out |
85 | 86 | ||
86 | def cmd_in_path(cmd, path): | ||
87 | import scriptpath | ||
88 | |||
89 | scriptpath.add_bitbake_lib_path() | ||
90 | |||
91 | return bb.utils.which(path, cmd) != "" or False | ||
92 | |||
93 | def exec_native_cmd(cmd_and_args, native_sysroot, catch=3, pseudo=""): | 87 | def exec_native_cmd(cmd_and_args, native_sysroot, catch=3, pseudo=""): |
94 | """ | 88 | """ |
95 | Execute native command, catching stderr, stdout | 89 | Execute native command, catching stderr, stdout |
@@ -112,7 +106,7 @@ def exec_native_cmd(cmd_and_args, native_sysroot, catch=3, pseudo=""): | |||
112 | msger.debug("exec_native_cmd: %s" % cmd_and_args) | 106 | msger.debug("exec_native_cmd: %s" % cmd_and_args) |
113 | 107 | ||
114 | # If the command isn't in the native sysroot say we failed. | 108 | # If the command isn't in the native sysroot say we failed. |
115 | if cmd_in_path(args[0], native_paths): | 109 | if spawn.find_executable(args[0], native_paths): |
116 | ret, out = _exec_cmd(native_cmd_and_args, True, catch) | 110 | ret, out = _exec_cmd(native_cmd_and_args, True, catch) |
117 | else: | 111 | else: |
118 | ret = 127 | 112 | ret = 127 |