mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Issue #869: Add option `-T
` for printing the full traceback on exception.
This commit is contained in:
parent
ab6706e6ed
commit
b338af55df
3
CHANGES
3
CHANGES
@ -1,6 +1,9 @@
|
||||
Release 1.2 (in development)
|
||||
============================
|
||||
|
||||
* #869: sphinx-build now has the option :option:`-T` for printing the full
|
||||
traceback after an unhandled exception.
|
||||
|
||||
* #940: Fix gettext does not extract figure caption.
|
||||
|
||||
* #1067: Improve the ordering of the JavaScript search results: matches in titles
|
||||
|
@ -59,6 +59,7 @@ new and changed files
|
||||
-w <file> -- write warnings (and errors) to given file
|
||||
-W -- turn warnings into errors
|
||||
-P -- run Pdb on exception
|
||||
-T -- show full traceback on exception
|
||||
Modi:
|
||||
* without -a and without filenames, write new and changed files.
|
||||
* with -a, write all files.
|
||||
@ -71,7 +72,7 @@ def main(argv):
|
||||
nocolor()
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(argv[1:], 'ab:t:d:c:CD:A:ng:NEqQWw:P')
|
||||
opts, args = getopt.getopt(argv[1:], 'ab:t:d:c:CD:A:ng:NEqQWw:PT')
|
||||
allopts = set(opt[0] for opt in opts)
|
||||
srcdir = confdir = abspath(args[0])
|
||||
if not path.isdir(srcdir):
|
||||
@ -109,6 +110,7 @@ def main(argv):
|
||||
|
||||
buildername = None
|
||||
force_all = freshenv = warningiserror = use_pdb = False
|
||||
show_traceback = False
|
||||
status = sys.stdout
|
||||
warning = sys.stderr
|
||||
error = sys.stderr
|
||||
@ -185,6 +187,8 @@ def main(argv):
|
||||
warnfile = val
|
||||
elif opt == '-P':
|
||||
use_pdb = True
|
||||
elif opt == '-T':
|
||||
show_traceback = True
|
||||
|
||||
if warning and warnfile:
|
||||
warnfp = open(warnfile, 'w')
|
||||
@ -197,14 +201,7 @@ def main(argv):
|
||||
warningiserror, tags)
|
||||
app.build(force_all, filenames)
|
||||
return app.statuscode
|
||||
except KeyboardInterrupt:
|
||||
if use_pdb:
|
||||
import pdb
|
||||
print >>error, red('Interrupted while building, starting debugger:')
|
||||
traceback.print_exc()
|
||||
pdb.post_mortem(sys.exc_info()[2])
|
||||
return 1
|
||||
except Exception, err:
|
||||
except (Exception, KeyboardInterrupt), err:
|
||||
if use_pdb:
|
||||
import pdb
|
||||
print >>error, red('Exception occurred while building, '
|
||||
@ -213,7 +210,12 @@ def main(argv):
|
||||
pdb.post_mortem(sys.exc_info()[2])
|
||||
else:
|
||||
print >>error
|
||||
if isinstance(err, SystemMessage):
|
||||
if show_traceback:
|
||||
traceback.print_exc(None, error)
|
||||
print >>error
|
||||
if isinstance(err, KeyboardInterrupt):
|
||||
print >>error, 'interrupted!'
|
||||
elif isinstance(err, SystemMessage):
|
||||
print >>error, red('reST markup error:')
|
||||
print >>error, terminal_safe(err.args[0])
|
||||
elif isinstance(err, SphinxError):
|
||||
|
Loading…
Reference in New Issue
Block a user