avoid importing prompt_toolkit

This commit is contained in:
adam j hartz 2016-05-28 10:28:09 -04:00
parent 1c50c9c335
commit 9979315e05
2 changed files with 3 additions and 9 deletions

View file

@ -44,8 +44,6 @@ class Shell(object):
kwargs.get('cacheall', False))
env = builtins.__xonsh_env__
# pick a valid shell
if shell_type is not None:
env['SHELL_TYPE'] = shell_type
shell_type = env.get('SHELL_TYPE')
if shell_type == 'best' or shell_type is None:
shell_type = best_shell_type()
@ -54,7 +52,8 @@ class Shell(object):
if shell_type == 'prompt_toolkit':
if not has_prompt_toolkit():
warn('prompt_toolkit is not available, using readline instead.')
shell_type = env['SHELL_TYPE'] = 'readline'
shell_type = 'readline'
env['SHELL_TYPE'] = shell_type
# actually make the shell
if shell_type == 'none':
from xonsh.base_shell import BaseShell as shell_class

View file

@ -36,11 +36,6 @@ from collections import OrderedDict, Sequence, Set
from xonsh.platform import (has_prompt_toolkit, scandir, win_unicode_console,
DEFAULT_ENCODING, ON_LINUX, ON_WINDOWS,
PYTHON_VERSION_INFO)
if has_prompt_toolkit():
import prompt_toolkit
else:
prompt_toolkit = None
IS_SUPERUSER = ctypes.windll.shell32.IsUserAnAdmin() != 0 if ON_WINDOWS else os.getuid() == 0
@ -882,7 +877,7 @@ def intensify_colors_for_cmd_exe(style_map, replace_colors=None):
range used by the gray colors
"""
modified_style = {}
if not ON_WINDOWS or prompt_toolkit is None:
if not ON_WINDOWS or builtins.__xonsh_shell__.stype != 'prompt_toolkit':
return modified_style
if replace_colors is None:
replace_colors = {1: '#44ffff', # subst blue with bright cyan