don't require prompt toolkit for docs on user side

we'll make sure it's available on CI when the docs are generated for the
website, but it shouldn't fail to build in userspace just because of the
ptk events hack thing
This commit is contained in:
Gil Forsyth 2017-02-28 15:17:43 -05:00
parent 91653dafa8
commit bc7d4117e9

View file

@ -11,6 +11,7 @@ import os
import sys
import builtins
import inspect
import importlib
os.environ['XONSH_DEBUG'] = '1'
@ -20,9 +21,13 @@ from xonsh.xontribs import xontrib_metadata
from xonsh import main
from xonsh.commands_cache import CommandsCache
# hacky runaround to import PTK-specific events
builtins.__xonsh_env__ = Env()
from xonsh.ptk.shell import events
spec = importlib.util.find_spec('prompt_toolkit')
if spec is not None:
# hacky runaround to import PTK-specific events
builtins.__xonsh_env__ = Env()
from xonsh.ptk.shell import events
else:
from xonsh.events import events
sys.path.insert(0, os.path.dirname(__file__))