summaryrefslogtreecommitdiffstats
path: root/bitbake/bin/bitbake
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/bitbake
parent146046bcda4e481cb221de59ac9858303d473fec (diff)
downloadpoky-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/bitbake')
-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 @@
24 24
25import sys, os, getopt, re, time, optparse, xmlrpclib 25import sys, os, getopt, re, time, optparse, xmlrpclib
26sys.path.insert(0,os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib')) 26sys.path.insert(0,os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
27
28import warnings
27import bb 29import bb
30import bb.msg
28from bb import cooker 31from bb import cooker
29from bb import ui 32from bb import ui
30from bb import server 33from bb import server
@@ -60,6 +63,21 @@ def print_exception(exc, value, tb):
60 63
61 sys.__excepthook__(exc, value, tb) 64 sys.__excepthook__(exc, value, tb)
62 65
66sys.excepthook = print_exception
67
68
69_warnings_showwarning = warnings.showwarning
70def _showwarning(message, category, filename, lineno, file=None, line=None):
71 """Display python warning messages using bb.msg"""
72 if file is not None:
73 if _warnings_showwarning is not None:
74 _warnings_showwarning(message, category, filename, lineno, file, line)
75 else:
76 s = warnings.formatwarning(message, category, filename, lineno)
77 s = s.split("\n")[0]
78 bb.msg.warn(None, s)
79
80warnings.showwarning = _showwarning
63 81
64#============================================================================# 82#============================================================================#
65# main 83# main
@@ -169,8 +187,6 @@ Default BBFILES are the .bb files in the current directory.""" )
169 server.BitBakeServerFork(serverinfo, cooker.serve, cooker_logfile) 187 server.BitBakeServerFork(serverinfo, cooker.serve, cooker_logfile)
170 del cooker 188 del cooker
171 189
172 sys.excepthook = print_exception
173
174 # Setup a connection to the server (cooker) 190 # Setup a connection to the server (cooker)
175 serverConnection = server.BitBakeServerConnection(serverinfo) 191 serverConnection = server.BitBakeServerConnection(serverinfo)
176 192