mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-06 09:20:57 +01:00
avoid importing prompt_toolkit
This commit is contained in:
parent
1c50c9c335
commit
9979315e05
2 changed files with 3 additions and 9 deletions
|
@ -44,8 +44,6 @@ class Shell(object):
|
||||||
kwargs.get('cacheall', False))
|
kwargs.get('cacheall', False))
|
||||||
env = builtins.__xonsh_env__
|
env = builtins.__xonsh_env__
|
||||||
# pick a valid shell
|
# pick a valid shell
|
||||||
if shell_type is not None:
|
|
||||||
env['SHELL_TYPE'] = shell_type
|
|
||||||
shell_type = env.get('SHELL_TYPE')
|
shell_type = env.get('SHELL_TYPE')
|
||||||
if shell_type == 'best' or shell_type is None:
|
if shell_type == 'best' or shell_type is None:
|
||||||
shell_type = best_shell_type()
|
shell_type = best_shell_type()
|
||||||
|
@ -54,7 +52,8 @@ class Shell(object):
|
||||||
if shell_type == 'prompt_toolkit':
|
if shell_type == 'prompt_toolkit':
|
||||||
if not has_prompt_toolkit():
|
if not has_prompt_toolkit():
|
||||||
warn('prompt_toolkit is not available, using readline instead.')
|
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
|
# actually make the shell
|
||||||
if shell_type == 'none':
|
if shell_type == 'none':
|
||||||
from xonsh.base_shell import BaseShell as shell_class
|
from xonsh.base_shell import BaseShell as shell_class
|
||||||
|
|
|
@ -36,11 +36,6 @@ from collections import OrderedDict, Sequence, Set
|
||||||
from xonsh.platform import (has_prompt_toolkit, scandir, win_unicode_console,
|
from xonsh.platform import (has_prompt_toolkit, scandir, win_unicode_console,
|
||||||
DEFAULT_ENCODING, ON_LINUX, ON_WINDOWS,
|
DEFAULT_ENCODING, ON_LINUX, ON_WINDOWS,
|
||||||
PYTHON_VERSION_INFO)
|
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
|
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
|
range used by the gray colors
|
||||||
"""
|
"""
|
||||||
modified_style = {}
|
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
|
return modified_style
|
||||||
if replace_colors is None:
|
if replace_colors is None:
|
||||||
replace_colors = {1: '#44ffff', # subst blue with bright cyan
|
replace_colors = {1: '#44ffff', # subst blue with bright cyan
|
||||||
|
|
Loading…
Add table
Reference in a new issue