Merge with develop and fix merge conflicts
This commit is contained in:
commit
72f4fedcbe
148 changed files with 20005 additions and 2718 deletions
|
|
@ -176,7 +176,7 @@ def _init():
|
|||
from .utils import logger
|
||||
from .utils import gametime
|
||||
from .utils import ansi
|
||||
from .utils.spawner import spawn
|
||||
from .prototypes.spawner import spawn
|
||||
from . import contrib
|
||||
from .utils.evmenu import EvMenu
|
||||
from .utils.evtable import EvTable
|
||||
|
|
@ -316,3 +316,64 @@ def _init():
|
|||
syscmdkeys = SystemCmds()
|
||||
del SystemCmds
|
||||
del _EvContainer
|
||||
|
||||
|
||||
del object
|
||||
del absolute_import
|
||||
del print_function
|
||||
|
||||
|
||||
def set_trace(debugger="auto", term_size=(140, 40)):
|
||||
"""
|
||||
Helper function for running a debugger inside the Evennia event loop.
|
||||
|
||||
Args:
|
||||
debugger (str, optional): One of 'auto', 'pdb' or 'pudb'. Pdb is the standard debugger. Pudb
|
||||
is an external package with a different, more 'graphical', ncurses-based UI. With
|
||||
'auto', will use pudb if possible, otherwise fall back to pdb. Pudb is available through
|
||||
`pip install pudb`.
|
||||
term_size (tuple, optional): Only used for Pudb and defines the size of the terminal
|
||||
(width, height) in number of characters.
|
||||
|
||||
Notes:
|
||||
To use:
|
||||
|
||||
1) add this to a line to act as a breakpoint for entering the debugger:
|
||||
|
||||
from evennia import set_trace; set_trace()
|
||||
|
||||
2) restart evennia in interactive mode
|
||||
|
||||
evennia istart
|
||||
|
||||
3) debugger will appear in the interactive terminal when breakpoint is reached. Exit
|
||||
with 'q', remove the break line and restart server when finished.
|
||||
|
||||
"""
|
||||
import sys
|
||||
dbg = None
|
||||
pudb_mode = False
|
||||
|
||||
if debugger in ('auto', 'pudb'):
|
||||
try:
|
||||
from pudb import debugger
|
||||
dbg = debugger.Debugger(stdout=sys.__stdout__,
|
||||
term_size=term_size)
|
||||
pudb_mode = True
|
||||
except ImportError:
|
||||
if debugger == 'pudb':
|
||||
raise
|
||||
pass
|
||||
|
||||
if not dbg:
|
||||
import pdb
|
||||
dbg = pdb.Pdb(stdout=sys.__stdout__)
|
||||
pudb_mode = False
|
||||
|
||||
if pudb_mode:
|
||||
# Stopped at breakpoint. Press 'n' to continue into the code.
|
||||
dbg.set_trace()
|
||||
else:
|
||||
# Start debugger, forcing it up one stack frame (otherwise `set_trace` will start debugger
|
||||
# this point, not the actual code location)
|
||||
dbg.set_trace(sys._getframe().f_back)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue