DetectionΒΆ
extra_platforms.detection
APIΒΆ
Heuristics to detect each platform.
All these heuristics can be hard-cached as the underlying system is not changing between code execution.
We mostly rely on distro to detect the
Linux distribution, as it is the recommended replacement for Pythonβs original
platform.linux_distribution
function (which was removed in Python 3.8).
We then fill in the gaps with sys.platform
and environment variables to detect
systems not covered by distro
.
This collection of heuristics is designed as a set of separate function with minimal logic and dependencies. That way we can double-check during execution that no heuristics are conflicting or matching multiple systems at the same time.
Note
Heuristics for unrecognized platforms can be transplanted from Rustβs sysinfo crate.
- extra_platforms.detection.is_aix()[source]ΒΆ
Return True only if current platform is AIX.
- Return type:
- extra_platforms.detection.is_altlinux()[source]ΒΆ
Return True only if current platform is ALT Linux.
- Return type:
- extra_platforms.detection.is_amzn()[source]ΒΆ
Return True only if current platform is Amazon Linux.
- Return type:
- extra_platforms.detection.is_android()[source]ΒΆ
Return True only if current platform is Android.
Source: https://github.com/kivy/kivy/blob/master/kivy/utils.py#L429
- Return type:
- extra_platforms.detection.is_arch()[source]ΒΆ
Return True only if current platform is Arch Linux.
- Return type:
- extra_platforms.detection.is_buildroot()[source]ΒΆ
Return True only if current platform is Buildroot.
- Return type:
- extra_platforms.detection.is_centos()[source]ΒΆ
Return True only if current platform is CentOS.
- Return type:
- extra_platforms.detection.is_cloudlinux()[source]ΒΆ
Return True only if current platform is CloudLinux OS.
- Return type:
- extra_platforms.detection.is_cygwin()[source]ΒΆ
Return True only if current platform is Cygwin.
- Return type:
- extra_platforms.detection.is_debian()[source]ΒΆ
Return True only if current platform is Debian.
- Return type:
- extra_platforms.detection.is_exherbo()[source]ΒΆ
Return True only if current platform is Exherbo Linux.
- Return type:
- extra_platforms.detection.is_fedora()[source]ΒΆ
Return True only if current platform is Fedora.
- Return type:
- extra_platforms.detection.is_freebsd()[source]ΒΆ
Return True only if current platform is FreeBSD.
- Return type:
- extra_platforms.detection.is_gentoo()[source]ΒΆ
Return True only if current platform is GenToo Linux.
- Return type:
- extra_platforms.detection.is_guix()[source]ΒΆ
Return True only if current platform is Guix System.
- Return type:
- extra_platforms.detection.is_hurd()[source]ΒΆ
Return True only if current platform is GNU/Hurd.
- Return type:
- extra_platforms.detection.is_ibm_powerkvm()[source]ΒΆ
Return True only if current platform is IBM PowerKVM.
- Return type:
- extra_platforms.detection.is_kvmibm()[source]ΒΆ
Return True only if current platform is KVM for IBM z Systems.
- Return type:
- extra_platforms.detection.is_linuxmint()[source]ΒΆ
Return True only if current platform is Linux Mint.
- Return type:
- extra_platforms.detection.is_macos()[source]ΒΆ
Return True only if current platform is macOS.
- Return type:
- extra_platforms.detection.is_mageia()[source]ΒΆ
Return True only if current platform is Mageia.
- Return type:
- extra_platforms.detection.is_mandriva()[source]ΒΆ
Return True only if current platform is Mandriva Linux.
- Return type:
- extra_platforms.detection.is_midnightbsd()[source]ΒΆ
Return True only if current platform is MidnightBSD.
- Return type:
- extra_platforms.detection.is_netbsd()[source]ΒΆ
Return True only if current platform is NetBSD.
- Return type:
- extra_platforms.detection.is_openbsd()[source]ΒΆ
Return True only if current platform is OpenBSD.
- Return type:
- extra_platforms.detection.is_opensuse()[source]ΒΆ
Return True only if current platform is openSUSE.
- Return type:
- extra_platforms.detection.is_oracle()[source]ΒΆ
Return True only if current platform is Oracle Linux (and Oracle Enterprise Linux).
- Return type:
- extra_platforms.detection.is_parallels()[source]ΒΆ
Return True only if current platform is Parallels.
- Return type:
- extra_platforms.detection.is_pidora()[source]ΒΆ
Return True only if current platform is Pidora.
- Return type:
- extra_platforms.detection.is_raspbian()[source]ΒΆ
Return True only if current platform is Raspbian.
- Return type:
- extra_platforms.detection.is_rhel()[source]ΒΆ
Return True only if current platform is RedHat Enterprise Linux.
- Return type:
- extra_platforms.detection.is_rocky()[source]ΒΆ
Return True only if current platform is Rocky Linux.
- Return type:
- extra_platforms.detection.is_scientific()[source]ΒΆ
Return True only if current platform is Scientific Linux.
- Return type:
- extra_platforms.detection.is_slackware()[source]ΒΆ
Return True only if current platform is Slackware.
- Return type:
- extra_platforms.detection.is_sles()[source]ΒΆ
Return True only if current platform is SUSE Linux Enterprise Server.
- Return type:
- extra_platforms.detection.is_solaris()[source]ΒΆ
Return True only if current platform is Solaris.
- Return type:
- extra_platforms.detection.is_sunos()[source]ΒΆ
Return True only if current platform is SunOS.
- Return type:
- extra_platforms.detection.is_tuxedo()[source]ΒΆ
Return True only if current platform is Tuxedo OS.
- Return type:
- extra_platforms.detection.is_ubuntu()[source]ΒΆ
Return True only if current platform is Ubuntu.
- Return type:
- extra_platforms.detection.is_unknown_linux()[source]ΒΆ
Return True only if current platform is an unknown Linux.
Excludes WSL1 and WSL2 from this check to avoid false positives.
- Return type:
- extra_platforms.detection.is_windows()[source]ΒΆ
Return True only if current platform is Windows.
- Return type:
- extra_platforms.detection.is_wsl1()[source]ΒΆ
Return True only if current platform is Windows Subsystem for Linux v1. :rtype:
bool
Caution
The only difference between WSL1 and WSL2 is the case of the kernel release version:
WSL 1:
$ uname -r 4.4.0-22572-Microsoft
WSL 2:
$ uname -r 5.10.102.1-microsoft-standard-WSL2