bitbake: ui: Improve error message if bitbake cannot import python curses module
authorKonrad Scherer <Konrad.Scherer@windriver.com>
Tue, 21 Aug 2012 21:05:58 +0000 (16:05 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 22 Aug 2012 12:59:57 +0000 (13:59 +0100)
On some SuSE systems, the curses python module is not installed by default.
Instead of a python failure, we want a nicer error message.

(On SuSE systems the package is typically python-curses.)

(Bitbake rev: 65a5845ac942d0aa6838c295e41b656f9d2a98bb)

Signed-off-by: Konrad Scherer <Konrad.Scherer@windriver.com>
Signed-off-by: Jeff Polk <jeff.polk@windriver.com>
Reword commit message, rebase to latest bitbake.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/ui/knotty.py
bitbake/lib/bb/ui/ncurses.py

index b01daee..858cacf 100644 (file)
@@ -141,7 +141,11 @@ class TerminalFilter(object):
         if not self.interactive:
             return
 
-        import curses
+        try:
+            import curses
+        except ImportError:
+            sys.exit("FATAL: The knotty ui could not load the required curses python module.")
+       
         import termios
         self.curses = curses
         self.termios = termios
index 1425bbd..f573b95 100644 (file)
 
 from __future__ import division
 import logging
-import os, sys, curses, itertools, time, subprocess
+import os, sys, itertools, time, subprocess
+
+try:
+    import curses
+except ImportError:
+    sys.exit("FATAL: The ncurses ui could not load the required curses python module.")
+
 import bb
 import xmlrpclib
 from bb import ui