From 1a7069e97b9ec208dc3cb70f9465b65de7e0a6f9 Mon Sep 17 00:00:00 2001 From: Konrad Scherer Date: Tue, 21 Aug 2012 16:05:58 -0500 Subject: bitbake: ui: Improve error message if bitbake cannot import python curses module 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 Signed-off-by: Jeff Polk Reword commit message, rebase to latest bitbake. Signed-off-by: Mark Hatle Signed-off-by: Richard Purdie --- bitbake/lib/bb/ui/knotty.py | 6 +++++- bitbake/lib/bb/ui/ncurses.py | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'bitbake/lib') diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index b01daee573..858cacfe55 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -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 diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py index 1425bbd263..f573b95574 100644 --- a/bitbake/lib/bb/ui/ncurses.py +++ b/bitbake/lib/bb/ui/ncurses.py @@ -47,7 +47,13 @@ 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 -- cgit v1.2.3-54-g00ecf