diff options
author | Chris Larson <clarson@mvista.com> | 2009-09-10 11:49:50 -0700 |
---|---|---|
committer | Chris Larson <clarson@mvista.com> | 2009-09-14 11:25:09 -0700 |
commit | afd1840d9d02178e451fe897bc21400105aa0fb3 (patch) | |
tree | 849e7190334b72ffb1e983a5243602635076954a /bin | |
parent | a002f4f0d13ea7dca261b77d5e2278c3fd35acda (diff) | |
download | bitbake-afd1840d9d02178e451fe897bc21400105aa0fb3.tar.gz |
Only print python exception tracebacks if debugging is enabled.
Uses sys.excepthook to replace the toplevel exception handler with a version
that obeys the debug level of the 'default' messaging domain. A non-zero
value there will result in displaying the full traceback.
Signed-off-by: Chris Larson <clarson@mvista.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/bitbake | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/bitbake b/bin/bitbake index 3fda4a012..f02630b10 100755 --- a/bin/bitbake +++ b/bin/bitbake @@ -48,6 +48,17 @@ class BBConfiguration( object ): setattr( self, key, val ) +def print_exception(exc, value, tb): + """ + Print the exception to stderr, only showing the traceback if bitbake + debugging is enabled. + """ + if not bb.msg.debug_level['default']: + tb = None + + sys.__excepthook__(exc, value, tb) + + #============================================================================# # main #============================================================================# @@ -148,6 +159,8 @@ Default BBFILES are the .bb files in the current directory.""" ) daemonize.createDaemon(cooker.serve, cooker_logfile) del cooker + sys.excepthook = print_exception + # Setup a connection to the server (cooker) server = xmlrpclib.Server("http://%s:%s" % (host, port), allow_none=True) # Setup an event receiving queue |