diff options
author | Darren Hart <dvhart@linux.intel.com> | 2013-10-15 14:46:24 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-12-12 16:59:55 +0000 |
commit | e395ace67198551630f4aeb7c7e52253687fb407 (patch) | |
tree | c7cd3c97b0c75b5bdbd31edcb8f30322ba6d22b1 /scripts/wic | |
parent | 30df3a1e7b08108692166f88b3de2d99fecf9a7d (diff) | |
download | poky-e395ace67198551630f4aeb7c7e52253687fb407.tar.gz |
wic: Check for external modules
Since eight unique files import rpm, perform a check at the top level
for the existence of the rpm module print a sensible error message if it
is not. This may be able to be removed if some of the core rpm
dependencies are removed from the mic libs.
Also check for urlgrabber.
This avoids a bracktrace in the event the modules are not installed
which can be very off-putting to would-be users.
(From OE-Core master rev: b11bfadba20c1f39a63e396e605a8316c2ed2a94)
(From OE-Core rev: 93b1d54bf377703cd0c7debce21b07b4fbf4e5a5)
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Cc: Tom Zanussi <tom.zanussi@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/wic')
-rwxr-xr-x | scripts/wic | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/wic b/scripts/wic index 425b665861..a7221c3610 100755 --- a/scripts/wic +++ b/scripts/wic | |||
@@ -31,11 +31,23 @@ | |||
31 | 31 | ||
32 | __version__ = "0.1.0" | 32 | __version__ = "0.1.0" |
33 | 33 | ||
34 | # Python Standard Library modules | ||
34 | import os | 35 | import os |
35 | import sys | 36 | import sys |
36 | import optparse | 37 | import optparse |
37 | import logging | 38 | import logging |
38 | 39 | ||
40 | # External modules | ||
41 | try: | ||
42 | import rpm | ||
43 | import urlgrabber | ||
44 | except ImportError: | ||
45 | print("ERROR: failed to import necessary modules.") | ||
46 | print("Please ensure the following modules are installed:") | ||
47 | print("\trpm"); | ||
48 | print("\turlgrabber"); | ||
49 | sys.exit(1) | ||
50 | |||
39 | scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0]))) | 51 | scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0]))) |
40 | lib_path = scripts_path + '/lib' | 52 | lib_path = scripts_path + '/lib' |
41 | sys.path = sys.path + [lib_path] | 53 | sys.path = sys.path + [lib_path] |