Пример #1
0
def _info(ns):
    env = builtins.__xonsh_env__
    try:
        ply.__version__ = ply.__version__
    except AttributeError:
        ply.__version__ = '3.8'
    data = [
        ('xonsh', XONSH_VERSION),
        ('Git SHA', githash()),
        ('Python', '{}.{}.{}'.format(*PYTHON_VERSION_INFO)),
        ('PLY', ply.__version__),
        ('have readline', is_readline_available()),
        ('prompt toolkit', ptk_version() or None),
        ('shell type', env.get('SHELL_TYPE')),
        ('pygments', pygments_version()),
        ('on posix', bool(ON_POSIX)),
        ('on linux', ON_LINUX)]
    if ON_LINUX:
        data.append(('distro', linux_distro()))
    data.extend([
        ('on darwin', ON_DARWIN),
        ('on windows', ON_WINDOWS),
        ('on cygwin', ON_CYGWIN),
        ('is superuser', is_superuser()),
        ('default encoding', DEFAULT_ENCODING),
        ('xonsh encoding', env.get('XONSH_ENCODING')),
        ('encoding errors', env.get('XONSH_ENCODING_ERRORS')),
    ])
    formatter = _xonfig_format_json if ns.json else _xonfig_format_human
    s = formatter(data)
    return s
Пример #2
0
def _info(ns):
    env = builtins.__xonsh__.env
    data = [("xonsh", XONSH_VERSION)]
    hash_, date_ = githash()
    if hash_:
        data.append(("Git SHA", hash_))
        data.append(("Commit Date", date_))
    data.extend([
        ("Python", "{}.{}.{}".format(*PYTHON_VERSION_INFO)),
        ("PLY", ply.__version__),
        ("have readline", is_readline_available()),
        ("prompt toolkit", ptk_version() or None),
        ("shell type", env.get("SHELL_TYPE")),
        ("pygments", pygments_version()),
        ("on posix", bool(ON_POSIX)),
        ("on linux", bool(ON_LINUX)),
    ])
    if ON_LINUX:
        data.append(("distro", linux_distro()))
    data.extend([
        ("on darwin", ON_DARWIN),
        ("on windows", ON_WINDOWS),
        ("on cygwin", ON_CYGWIN),
        ("on msys2", ON_MSYS),
        ("is superuser", is_superuser()),
        ("default encoding", DEFAULT_ENCODING),
        ("xonsh encoding", env.get("XONSH_ENCODING")),
        ("encoding errors", env.get("XONSH_ENCODING_ERRORS")),
    ])
    formatter = _xonfig_format_json if ns.json else _xonfig_format_human
    s = formatter(data)
    return s
Пример #3
0
def _info(ns):
    env = builtins.__xonsh_env__
    try:
        ply.__version__ = ply.__version__
    except AttributeError:
        ply.__version__ = '3.8'
    data = [('xonsh', XONSH_VERSION), ('Git SHA', githash()),
            ('Python', '{}.{}.{}'.format(*PYTHON_VERSION_INFO)),
            ('PLY', ply.__version__),
            ('have readline', is_readline_available()),
            ('prompt toolkit', ptk_version() or None),
            ('shell type', env.get('SHELL_TYPE')),
            ('pygments', pygments_version()), ('on posix', bool(ON_POSIX)),
            ('on linux', ON_LINUX)]
    if ON_LINUX:
        data.append(('distro', linux_distro()))
    data.extend([
        ('on darwin', ON_DARWIN),
        ('on windows', ON_WINDOWS),
        ('on cygwin', ON_CYGWIN),
        ('is superuser', is_superuser()),
        ('default encoding', DEFAULT_ENCODING),
        ('xonsh encoding', env.get('XONSH_ENCODING')),
        ('encoding errors', env.get('XONSH_ENCODING_ERRORS')),
    ])
    formatter = _xonfig_format_json if ns.json else _xonfig_format_human
    s = formatter(data)
    return s
Пример #4
0
def _info(ns):
    env = builtins.__xonsh_env__
    try:
        ply.__version__ = ply.__version__
    except AttributeError:
        ply.__version__ = "3.8"
    data = [
        ("xonsh", XONSH_VERSION),
        ("Git SHA", githash()),
        ("Python", "{}.{}.{}".format(*PYTHON_VERSION_INFO)),
        ("PLY", ply.__version__),
        ("have readline", is_readline_available()),
        ("prompt toolkit", ptk_version() or None),
        ("shell type", env.get("SHELL_TYPE")),
        ("pygments", pygments_version()),
        ("on posix", bool(ON_POSIX)),
        ("on linux", ON_LINUX),
    ]
    if ON_LINUX:
        data.append(("distro", linux_distro()))
    data.extend(
        [
            ("on darwin", ON_DARWIN),
            ("on windows", ON_WINDOWS),
            ("on cygwin", ON_CYGWIN),
            ("is superuser", is_superuser()),
            ("default encoding", DEFAULT_ENCODING),
            ("xonsh encoding", env.get("XONSH_ENCODING")),
            ("encoding errors", env.get("XONSH_ENCODING_ERRORS")),
        ]
    )
    formatter = _xonfig_format_json if ns.json else _xonfig_format_human
    s = formatter(data)
    return s
Пример #5
0
def _info(to_json=False, ) -> str:
    """Displays configuration information

    Parameters
    ----------
    to_json : -j, --json
        reports results as json
    """
    env = XSH.env
    data: tp.List[tp.Any] = [("xonsh", XONSH_VERSION)]
    hash_, date_ = githash()
    if hash_:
        data.append(("Git SHA", hash_))
        data.append(("Commit Date", date_))
    data.extend([
        ("Python", "{}.{}.{}".format(*PYTHON_VERSION_INFO)),
        ("PLY", ply.__version__),
        ("have readline", is_readline_available()),
        ("prompt toolkit", ptk_version() or None),
        ("shell type", env.get("SHELL_TYPE")),
        ("history backend", env.get("XONSH_HISTORY_BACKEND")),
        ("pygments", pygments_version()),
        ("on posix", bool(ON_POSIX)),
        ("on linux", bool(ON_LINUX)),
    ])
    if ON_LINUX:
        data.append(("distro", linux_distro()))
        data.append(("on wsl", bool(ON_WSL)))
        if ON_WSL:
            data.append(("wsl version", 1 if ON_WSL1 else 2))
    data.extend([
        ("on darwin", bool(ON_DARWIN)),
        ("on windows", bool(ON_WINDOWS)),
        ("on cygwin", bool(ON_CYGWIN)),
        ("on msys2", bool(ON_MSYS)),
        ("is superuser", is_superuser()),
        ("default encoding", DEFAULT_ENCODING),
        ("xonsh encoding", env.get("XONSH_ENCODING")),
        ("encoding errors", env.get("XONSH_ENCODING_ERRORS")),
    ])
    jup_ksm = jup_kernel = None
    try:
        from jupyter_client.kernelspec import KernelSpecManager

        jup_ksm = KernelSpecManager()
        jup_kernel = jup_ksm.find_kernel_specs().get(XONSH_JUPYTER_KERNEL)
    except Exception:
        pass
    data.extend([("on jupyter", jup_ksm is not None),
                 ("jupyter kernel", jup_kernel)])

    data.extend([("xontrib", xontribs_loaded())])
    data.extend([("RC file", XSH.rc_files)])

    formatter = _xonfig_format_json if to_json else _xonfig_format_human
    s = formatter(data)
    return s
Пример #6
0
def _info(ns):
    env = builtins.__xonsh__.env
    data = [("xonsh", XONSH_VERSION)]
    hash_, date_ = githash()
    if hash_:
        data.append(("Git SHA", hash_))
        data.append(("Commit Date", date_))
    data.extend(
        [
            ("Python", "{}.{}.{}".format(*PYTHON_VERSION_INFO)),
            ("PLY", ply.__version__),
            ("have readline", is_readline_available()),
            ("prompt toolkit", ptk_version() or None),
            ("shell type", env.get("SHELL_TYPE")),
            ("pygments", pygments_version()),
            ("on posix", bool(ON_POSIX)),
            ("on linux", bool(ON_LINUX)),
        ]
    )
    if ON_LINUX:
        data.append(("distro", linux_distro()))
    data.extend(
        [
            ("on darwin", bool(ON_DARWIN)),
            ("on windows", bool(ON_WINDOWS)),
            ("on cygwin", bool(ON_CYGWIN)),
            ("on msys2", bool(ON_MSYS)),
            ("is superuser", is_superuser()),
            ("default encoding", DEFAULT_ENCODING),
            ("xonsh encoding", env.get("XONSH_ENCODING")),
            ("encoding errors", env.get("XONSH_ENCODING_ERRORS")),
        ]
    )
    jup_ksm = jup_kernel = None
    try:
        from jupyter_client.kernelspec import KernelSpecManager

        jup_ksm = KernelSpecManager()
        jup_kernel = jup_ksm.find_kernel_specs().get(XONSH_JUPYTER_KERNEL)
    except Exception:
        pass
    data.extend([("on jupyter", jup_ksm is not None), ("jupyter kernel", jup_kernel)])

    data.extend([("xontrib", xontribs_loaded())])

    formatter = _xonfig_format_json if ns.json else _xonfig_format_human
    s = formatter(data)
    return s
Пример #7
0
def _info(ns):
    data = [('xonsh', XONSH_VERSION),
            ('Python', '{}.{}.{}'.format(*platform.PYTHON_VERSION_INFO)),
            ('PLY', ply.__version__),
            ('have readline', is_readline_available()),
            ('prompt toolkit', ptk_version() or None),
            ('pygments', platform.PYGMENTS_VERSION),
            ('on posix', platform.ON_POSIX), ('on linux', platform.ON_LINUX)]
    if platform.ON_LINUX:
        data.append(('distro', platform.LINUX_DISTRO))
    data.extend([
        ('on darwin', platform.ON_DARWIN),
        ('on windows', platform.ON_WINDOWS),
        ('is superuser', tools.IS_SUPERUSER),
        ('default encoding', platform.DEFAULT_ENCODING),
    ])
    formatter = _format_json if ns.json else _format_human
    s = formatter(data)
    return s
Пример #8
0
def _info(ns):
    data = [
        ('xonsh', XONSH_VERSION),
        ('Python', '{}.{}.{}'.format(*platform.PYTHON_VERSION_INFO)),
        ('PLY', ply.__version__),
        ('have readline', is_readline_available()),
        ('prompt toolkit', ptk_version() or None),
        ('pygments', platform.PYGMENTS_VERSION),
        ('on posix', platform.ON_POSIX),
        ('on linux', platform.ON_LINUX)]
    if platform.ON_LINUX:
        data.append(('distro', platform.LINUX_DISTRO))
    data.extend([
        ('on darwin', platform.ON_DARWIN),
        ('on windows', platform.ON_WINDOWS),
        ('is superuser', tools.IS_SUPERUSER),
        ('default encoding', platform.DEFAULT_ENCODING),
        ])
    formatter = _format_json if ns.json else _format_human
    s = formatter(data)
    return s