diff options
Diffstat (limited to 'scripts/wic')
-rwxr-xr-x | scripts/wic | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/scripts/wic b/scripts/wic index 5bedd90f87..7d388c9768 100755 --- a/scripts/wic +++ b/scripts/wic | |||
@@ -36,19 +36,25 @@ import os | |||
36 | import sys | 36 | import sys |
37 | import optparse | 37 | import optparse |
38 | import logging | 38 | import logging |
39 | from distutils import spawn | ||
39 | 40 | ||
40 | # External modules | 41 | # External modules |
41 | scripts_path = os.path.abspath(os.path.dirname(__file__)) | 42 | scripts_path = os.path.abspath(os.path.dirname(__file__)) |
42 | lib_path = scripts_path + '/lib' | 43 | lib_path = scripts_path + '/lib' |
43 | bitbake_path = os.path.join(scripts_path, '../bitbake/lib') | 44 | sys.path.append(lib_path) |
44 | sys.path = sys.path + [lib_path, bitbake_path] | 45 | |
46 | bitbake_exe = spawn.find_executable('bitbake') | ||
47 | if bitbake_exe: | ||
48 | bitbake_path = os.path.join(os.path.dirname(bitbake_exe), '../lib') | ||
49 | sys.path.append(bitbake_path) | ||
50 | from bb import cookerdata | ||
51 | from bb.main import bitbake_main, BitBakeConfigParameters | ||
52 | else: | ||
53 | bitbake_main = None | ||
45 | 54 | ||
46 | from image.help import * | 55 | from image.help import * |
47 | from image.engine import * | 56 | from image.engine import * |
48 | 57 | ||
49 | from bb import cookerdata | ||
50 | from bb.main import bitbake_main, BitBakeConfigParameters | ||
51 | |||
52 | def rootfs_dir_to_args(krootfs_dir): | 58 | def rootfs_dir_to_args(krootfs_dir): |
53 | """ | 59 | """ |
54 | Get a rootfs_dir dict and serialize to string | 60 | Get a rootfs_dir dict and serialize to string |
@@ -109,6 +115,10 @@ def wic_create_subcommand(args, usage_str): | |||
109 | parser.print_help() | 115 | parser.print_help() |
110 | sys.exit(1) | 116 | sys.exit(1) |
111 | 117 | ||
118 | if options.build_rootfs and not bitbake_main: | ||
119 | logging.error("Can't build roofs as bitbake is not in the $PATH") | ||
120 | sys.exit(1) | ||
121 | |||
112 | if not options.image_name and not (options.rootfs_dir and | 122 | if not options.image_name and not (options.rootfs_dir and |
113 | options.bootimg_dir and | 123 | options.bootimg_dir and |
114 | options.kernel_dir and | 124 | options.kernel_dir and |