aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDarren Hart <dvhart@linux.intel.com>2013-10-15 14:46:24 -0700
committerRobert Yang <liezhi.yang@windriver.com>2013-12-10 21:12:17 -0500
commit93b1d54bf377703cd0c7debce21b07b4fbf4e5a5 (patch)
treea6ae01b18d643181f384e3f1eca95a05ab830b91 /scripts
parente437cd5ccaa44798107a6aa5177b1b867c94dfc3 (diff)
downloadopenembedded-core-contrib-93b1d54bf377703cd0c7debce21b07b4fbf4e5a5.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) 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>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/wic12
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 @@
__version__ = "0.1.0"
+# Python Standard Library modules
import os
import sys
import optparse
import logging
+# External modules
+try:
+ import rpm
+ import urlgrabber
+except ImportError:
+ print("ERROR: failed to import necessary modules.")
+ print("Please ensure the following modules are installed:")
+ print("\trpm");
+ print("\turlgrabber");
+ sys.exit(1)
+
scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0])))
lib_path = scripts_path + '/lib'
sys.path = sys.path + [lib_path]