diff options
-rwxr-xr-x | bitbake/bin/bitbake | 20 |
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 | ||
25 | import sys, os, getopt, re, time, optparse, xmlrpclib | 25 | import sys, os, getopt, re, time, optparse, xmlrpclib |
26 | sys.path.insert(0,os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib')) | 26 | sys.path.insert(0,os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib')) |
27 | |||
28 | import warnings | ||
27 | import bb | 29 | import bb |
30 | import bb.msg | ||
28 | from bb import cooker | 31 | from bb import cooker |
29 | from bb import ui | 32 | from bb import ui |
30 | from bb import server | 33 | from 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 | ||
66 | sys.excepthook = print_exception | ||
67 | |||
68 | |||
69 | _warnings_showwarning = warnings.showwarning | ||
70 | def _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 | |||
80 | warnings.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 | ||