Platform-specific constants and implementations (xonsh.platform)¶
Module for platform-specific constants and implementations, as well as compatibility layers to make use of the ‘best’ implementation available on a platform.
-
xonsh.platform.pathbasename(p)[source]¶ This is a safe version of os.path.basename(), which does not work on input without a drive. This version does.
-
xonsh.platform.pathsplit(p)[source]¶ This is a safe version of os.path.split(), which does not work on input without a drive.
-
xonsh.platform.windows_expanduser(path)[source]¶ A Windows-specific expanduser() function for xonsh. This is needed since os.path.expanduser() does not check on Windows if the user actually exists. This restricts expanding the ‘~’ if it is not followed by a separator. That is only ‘~/’ and ‘~’ are expanded.
-
xonsh.platform.CAN_RESIZE_WINDOW= <xonsh.lazyasd.LazyBool object>¶ Trueif we can resize terminal window, as provided by the presense of signal.SIGWINCH, elseFalse.
-
xonsh.platform.DEFAULT_ENCODING= 'utf-8'¶ Default string encoding.
-
xonsh.platform.ON_ANACONDA= <xonsh.lazyasd.LazyBool object>¶ Trueif executed in an Anaconda instance, elseFalse.
-
xonsh.platform.ON_CYGWIN= False¶ Trueif executed on a Cygwin Windows platform, elseFalse.
-
xonsh.platform.ON_DARWIN= False¶ Trueif executed on a Darwin platform, elseFalse.
-
xonsh.platform.ON_DRAGONFLY= False¶ Trueif on a DragonFly BSD operating system, elseFalse.
-
xonsh.platform.ON_FREEBSD= False¶ Trueif on a FreeBSD operating system, elseFalse.
-
xonsh.platform.ON_LINUX= True¶ Trueif executed on a Linux platform, elseFalse.
-
xonsh.platform.ON_MSYS= False¶ Trueif executed on a MSYS Windows platform, elseFalse.
-
xonsh.platform.ON_NETBSD= False¶ Trueif on a NetBSD operating system, elseFalse.
-
xonsh.platform.ON_OPENBSD= False¶ Trueif on a OpenBSD operating system, elseFalse.
-
xonsh.platform.ON_POSIX= True¶ Trueif executed on a POSIX-compliant platform, elseFalse.
-
xonsh.platform.ON_WINDOWS= False¶ Trueif executed on a native Windows platform, elseFalse.
-
xonsh.platform.PYTHON_VERSION_INFO= (3, 8, 1)¶ Version of Python interpreter as three-value tuple.
-
xonsh.platform.git_for_windows_path[source]¶ Returns the path to git for windows, if available and None otherwise.
-
xonsh.platform.linux_distro[source]¶ The id of the Linux distribution running on, possibly ‘unknown’. None on non-Linux platforms.
-
xonsh.platform.ptk_shell_type[source]¶ Returns the prompt_toolkit shell type based on the installed version.
-
xonsh.platform.scandir()¶ This is either os.scandir on Python 3.5+ or a function providing a compatibility layer for it. It is recommended for iterations over directory entries at a significantly higher speed than os.listdir on Python 3.5+. It also caches properties that are commonly used for filtering.
Parameters: path (str) – The path to scan for entries. Returns: A generator yielding DirEntry instances.