summaryrefslogtreecommitdiffstats
path: root/bitbake/bin
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-04-09 15:55:55 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-07-02 15:41:32 +0100
commita91d123ef4eb315c8a44b16518fa3b40cb09fb8a (patch)
tree8ee705feab5759a22e839f07efc1054e75278d89 /bitbake/bin
parent146046bcda4e481cb221de59ac9858303d473fec (diff)
downloadopenembedded-core-contrib-a91d123ef4eb315c8a44b16518fa3b40cb09fb8a.tar.gz
Display python warnings via bb.msg
(Bitbake rev: 648415a562d92109c4945cb3cc98ed2ec44667a7) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-xbitbake/bin/bitbake20
1 files changed, 18 insertions, 2 deletions
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
index c2088d9320..8fdb6540a2 100755
--- a/bitbake/bin/bitbake
+++ b/bitbake/bin/bitbake
@@ -24,7 +24,10 @@
import sys, os, getopt, re, time, optparse, xmlrpclib
sys.path.insert(0,os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
+
+import warnings
import bb
+import bb.msg
from bb import cooker
from bb import ui
from bb import server
@@ -60,6 +63,21 @@ def print_exception(exc, value, tb):
sys.__excepthook__(exc, value, tb)
+sys.excepthook = print_exception
+
+
+_warnings_showwarning = warnings.showwarning
+def _showwarning(message, category, filename, lineno, file=None, line=None):
+ """Display python warning messages using bb.msg"""
+ if file is not None:
+ if _warnings_showwarning is not None:
+ _warnings_showwarning(message, category, filename, lineno, file, line)
+ else:
+ s = warnings.formatwarning(message, category, filename, lineno)
+ s = s.split("\n")[0]
+ bb.msg.warn(None, s)
+
+warnings.showwarning = _showwarning
#============================================================================#
# main
@@ -169,8 +187,6 @@ Default BBFILES are the .bb files in the current directory.""" )
server.BitBakeServerFork(serverinfo, cooker.serve, cooker_logfile)
del cooker
- sys.excepthook = print_exception
-
# Setup a connection to the server (cooker)
serverConnection = server.BitBakeServerConnection(serverinfo)