Allow running calibre in debug mode via an environment variable

This commit is contained in:
Kovid Goyal 2017-05-14 21:55:59 +05:30
parent ea39c2f7e6
commit 0bddbb67ad
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 5 additions and 2 deletions

View File

@ -87,7 +87,7 @@ else:
filesystem_encoding = 'utf-8' filesystem_encoding = 'utf-8'
DEBUG = False DEBUG = b'CALIBRE_DEBUG' in os.environ
def debug(): def debug():

View File

@ -250,7 +250,6 @@ def main(args=sys.argv):
opts, args = option_parser().parse_args(args) opts, args = option_parser().parse_args(args)
if opts.gui: if opts.gui:
from calibre.gui_launch import calibre from calibre.gui_launch import calibre
print_basic_debug_info()
calibre(['calibre']) calibre(['calibre'])
elif opts.gui_debug is not None: elif opts.gui_debug is not None:
run_debug_gui(opts.gui_debug) run_debug_gui(opts.gui_debug)

View File

@ -63,6 +63,10 @@ def register_with_default_programs():
def calibre(args=sys.argv): def calibre(args=sys.argv):
from calibre.constants import DEBUG
if DEBUG:
from calibre.debug import print_basic_debug_info
print_basic_debug_info()
detach_gui() detach_gui()
init_dbus() init_dbus()
with register_with_default_programs(): with register_with_default_programs():