extra_platforms packageΒΆ
Expose package-wide elements.
- extra_platforms.ALL_OS_LABELS: FrozenSet[str] = frozenset({'ALT Linux', 'Amazon Linux', 'Android', 'Arch Linux', 'Buildroot', 'CentOS', 'CloudLinux OS', 'Cygwin', 'Debian', 'Exherbo Linux', 'Fedora', 'FreeBSD', 'GNU/Hurd', 'Gentoo Linux', 'Guix System', 'IBM AIX', 'IBM PowerKVM', 'KVM for IBM z Systems', 'Linux Mint', 'Mageia', 'Mandriva Linux', 'MidnightBSD', 'NetBSD', 'OpenBSD', 'Oracle Linux', 'Parallels', 'Pidora', 'Raspbian', 'RedHat Enterprise Linux', 'Rocky Linux', 'SUSE Linux Enterprise Server', 'Scientific Linux', 'Slackware', 'Solaris', 'SunOS', 'Ubuntu', 'Unknown Linux', 'Windows', 'Windows Subsystem for Linux v1', 'Windows Subsystem for Linux v2', 'XenServer', 'macOS', 'openSUSE'})ΒΆ
Sets of all recognized labels.
- class extra_platforms.Group(id, name, icon='β', platforms=<factory>, platform_ids=<factory>)[source]ΒΆ
Bases:
object
A
Group
identify a collection ofPlatform
.Used to group platforms of the same family.
-
platform_ids:
frozenset
[str
]ΒΆ Set of platform IDs that belong to this group.
Used to test platform overlaps between groups.
- isdisjoint(other)[source]ΒΆ
Return True if the group has no platforms in common with
other
.- Return type:
-
platform_ids:
- extra_platforms.is_altlinux()[source]ΒΆ
Return True only if current platform is ALT Linux.
- Return type:
- extra_platforms.is_amzn()[source]ΒΆ
Return True only if current platform is Amazon Linux.
- Return type:
- extra_platforms.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.is_arch()[source]ΒΆ
Return True only if current platform is Arch Linux.
- Return type:
- extra_platforms.is_buildroot()[source]ΒΆ
Return True only if current platform is Buildroot.
- Return type:
- extra_platforms.is_cloudlinux()[source]ΒΆ
Return True only if current platform is CloudLinux OS.
- Return type:
- extra_platforms.is_exherbo()[source]ΒΆ
Return True only if current platform is Exherbo Linux.
- Return type:
- extra_platforms.is_freebsd()[source]ΒΆ
Return True only if current platform is FreeBSD.
- Return type:
- extra_platforms.is_gentoo()[source]ΒΆ
Return True only if current platform is GenToo Linux.
- Return type:
- extra_platforms.is_guix()[source]ΒΆ
Return True only if current platform is Guix System.
- Return type:
- extra_platforms.is_ibm_powerkvm()[source]ΒΆ
Return True only if current platform is IBM PowerKVM.
- Return type:
- extra_platforms.is_kvmibm()[source]ΒΆ
Return True only if current platform is KVM for IBM z Systems.
- Return type:
- extra_platforms.is_linuxmint()[source]ΒΆ
Return True only if current platform is Linux Mint.
- Return type:
- extra_platforms.is_mandriva()[source]ΒΆ
Return True only if current platform is Mandriva Linux.
- Return type:
- extra_platforms.is_midnightbsd()[source]ΒΆ
Return True only if current platform is MidnightBSD.
- Return type:
- extra_platforms.is_openbsd()[source]ΒΆ
Return True only if current platform is OpenBSD.
- Return type:
- extra_platforms.is_opensuse()[source]ΒΆ
Return True only if current platform is openSUSE.
- Return type:
- extra_platforms.is_oracle()[source]ΒΆ
Return True only if current platform is Oracle Linux (and Oracle Enterprise Linux).
- Return type:
- extra_platforms.is_parallels()[source]ΒΆ
Return True only if current platform is Parallels.
- Return type:
- extra_platforms.is_raspbian()[source]ΒΆ
Return True only if current platform is Raspbian.
- Return type:
- extra_platforms.is_rhel()[source]ΒΆ
Return True only if current platform is RedHat Enterprise Linux.
- Return type:
- extra_platforms.is_rocky()[source]ΒΆ
Return True only if current platform is Rocky Linux.
- Return type:
- extra_platforms.is_scientific()[source]ΒΆ
Return True only if current platform is Scientific Linux.
- Return type:
- extra_platforms.is_slackware()[source]ΒΆ
Return True only if current platform is Slackware.
- Return type:
- extra_platforms.is_sles()[source]ΒΆ
Return True only if current platform is SUSE Linux Enterprise Server.
- Return type:
- extra_platforms.is_solaris()[source]ΒΆ
Return True only if current platform is Solaris.
- Return type:
- extra_platforms.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.is_windows()[source]ΒΆ
Return True only if current platform is Windows.
- Return type:
- extra_platforms.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
- extra_platforms.is_wsl2()[source]ΒΆ
Return True only if current platform is Windows Subsystem for Linux v2.
- Return type:
- extra_platforms.is_xenserver()[source]ΒΆ
Return True only if current platform is XenServer.
- Return type:
- class extra_platforms.Platform(id, name, icon='β')[source]ΒΆ
Bases:
object
A platform can identify multiple distributions or OSes with the same characteristics.
It has a unique ID, a human-readable name, and boolean to flag current platform.
- extra_platforms.reduce(items)[source]ΒΆ
Reduce a collection of
Group
andPlatform
to a minimal set.Returns a deduplicated set of
Group
andPlatform
that covers the same exact platforms as the original input, but group as much platforms as possible, to reduce the number of items. :rtype:set
[Group
|Platform
]Hint
Maybe this could be solved with some Euler diagram algorithms, like those implemented in eule.
This is being discussed upstream at trouchet/eule#120.
Todo
Should we rename or alias this method to collapse()? Cannot decide if it is more descriptive or notβ¦
SubmodulesΒΆ
extra_platforms.detection moduleΒΆ
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_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
extra_platforms.docs_update moduleΒΆ
Automation to keep extra-platforms documentation up-to-date.
Tip
When the module is called directly, it will update all documentation files in-place:
$ run python -m extra_platforms.docs_update
See how it is used in .github/workflows/docs.yaml workflow.
- extra_platforms.docs_update.replace_content(filepath, start_tag, end_tag, new_content)[source]ΒΆ
Replace in the provided file the content surrounded by the provided tags.
- Return type:
- extra_platforms.docs_update.generate_platform_sankey()[source]ΒΆ
Produce a Sankey diagram to map all platforms to their platforms.
- Return type:
- extra_platforms.docs_update.generate_platforms_graph(graph_id, description, groups)[source]ΒΆ
Generates an Euler diagram of platform and their grouping.
Euler diagrams are not supported by mermaid yet so we fallback on a flowchart without arrows.
Returns a ready to use and properly indented MyST block.
- Return type:
extra_platforms.groups moduleΒΆ
Group definitions. Also known as families or categories.
- class extra_platforms.groups.Group(id, name, icon='β', platforms=<factory>, platform_ids=<factory>)[source]ΒΆ
Bases:
object
A
Group
identify a collection ofPlatform
.Used to group platforms of the same family.
-
platform_ids:
frozenset
[str
]ΒΆ Set of platform IDs that belong to this group.
Used to test platform overlaps between groups.
- isdisjoint(other)[source]ΒΆ
Return True if the group has no platforms in common with
other
.- Return type:
-
platform_ids:
- extra_platforms.groups.ALL_PLATFORMS: Group = Group(id='all_platforms', name='All platforms', platform_ids=frozenset({'linuxmint', 'gentoo', 'unknown_linux', 'freebsd', 'slackware', 'netbsd', 'rocky', 'wsl1', 'midnightbsd', 'arch', 'kvmibm', 'opensuse', 'openbsd', 'buildroot', 'centos', 'amzn', 'xenserver', 'sunos', 'guix', 'hurd', 'cloudlinux', 'pidora', 'rhel', 'windows', 'mandriva', 'ibm_powerkvm', 'mageia', 'aix', 'sles', 'exherbo', 'debian', 'scientific', 'macos', 'oracle', 'solaris', 'android', 'wsl2', 'raspbian', 'cygwin', 'altlinux', 'ubuntu', 'parallels', 'fedora'}))ΒΆ
All recognized platforms.
- extra_platforms.groups.ANY_WINDOWS = Group(id='any_windows', name='Any Windows', platform_ids=frozenset({'windows'}))ΒΆ
All Windows operating systems.
- extra_platforms.groups.UNIX = Group(id='unix', name='Any Unix', platform_ids=frozenset({'linuxmint', 'gentoo', 'unknown_linux', 'freebsd', 'slackware', 'netbsd', 'rocky', 'wsl1', 'midnightbsd', 'arch', 'kvmibm', 'opensuse', 'openbsd', 'buildroot', 'centos', 'amzn', 'xenserver', 'sunos', 'guix', 'hurd', 'cloudlinux', 'pidora', 'rhel', 'mandriva', 'ibm_powerkvm', 'mageia', 'aix', 'sles', 'exherbo', 'debian', 'scientific', 'macos', 'oracle', 'solaris', 'android', 'wsl2', 'raspbian', 'cygwin', 'altlinux', 'ubuntu', 'parallels', 'fedora'}))ΒΆ
All Unix-like operating systems and compatibility layers.
- extra_platforms.groups.UNIX_WITHOUT_MACOS = Group(id='unix_without_macos', name='Any Unix but macOS', platform_ids=frozenset({'linuxmint', 'gentoo', 'unknown_linux', 'freebsd', 'slackware', 'netbsd', 'rocky', 'wsl1', 'midnightbsd', 'arch', 'kvmibm', 'opensuse', 'openbsd', 'buildroot', 'centos', 'amzn', 'xenserver', 'sunos', 'guix', 'hurd', 'cloudlinux', 'pidora', 'rhel', 'mandriva', 'ibm_powerkvm', 'mageia', 'aix', 'sles', 'exherbo', 'debian', 'scientific', 'oracle', 'solaris', 'android', 'wsl2', 'raspbian', 'cygwin', 'altlinux', 'ubuntu', 'parallels', 'fedora'}))ΒΆ
All Unix platforms, without macOS.
This is useful to avoid macOS-specific workarounds on Unix platforms.
- extra_platforms.groups.BSD = Group(id='bsd', name='Any BSD', platform_ids=frozenset({'macos', 'sunos', 'freebsd', 'openbsd', 'netbsd', 'midnightbsd'}))ΒΆ
All BSD platforms.
Note
Are considered of this family (according Wikipedia):
386BSD (FreeBSD, NetBSD, OpenBSD, DragonFly BSD)
NeXTSTEP
Darwin (macOS, iOS, audioOS, iPadOS, tvOS, watchOS, bridgeOS)
SunOS
Ultrix
- extra_platforms.groups.BSD_WITHOUT_MACOS = Group(id='bsd_without_macos', name='Any BSD but macOS', platform_ids=frozenset({'sunos', 'freebsd', 'openbsd', 'netbsd', 'midnightbsd'}))ΒΆ
All BSD platforms, without macOS.
This is useful to avoid macOS-specific workarounds on BSD platforms.
- extra_platforms.groups.LINUX = Group(id='linux', name='Any Linux distribution', platform_ids=frozenset({'linuxmint', 'gentoo', 'unknown_linux', 'slackware', 'mandriva', 'rocky', 'ibm_powerkvm', 'mageia', 'arch', 'kvmibm', 'opensuse', 'sles', 'exherbo', 'buildroot', 'centos', 'debian', 'scientific', 'amzn', 'oracle', 'android', 'xenserver', 'fedora', 'raspbian', 'altlinux', 'ubuntu', 'guix', 'parallels', 'rhel', 'cloudlinux', 'pidora'}))ΒΆ
All distributions based on a Linux kernel.
- extra_platforms.groups.LINUX_LAYERS = Group(id='linux_layers', name='Any Linux compatibility layers', platform_ids=frozenset({'wsl2', 'wsl1'}))ΒΆ
Interfaces that allows Linux binaries to run on a different host system.
- extra_platforms.groups.LINUX_LIKE = Group(id='linux_like', name='Any Linux and compatibility layers', platform_ids=frozenset({'linuxmint', 'gentoo', 'unknown_linux', 'slackware', 'rocky', 'wsl1', 'arch', 'kvmibm', 'opensuse', 'buildroot', 'centos', 'amzn', 'xenserver', 'guix', 'rhel', 'cloudlinux', 'pidora', 'mandriva', 'ibm_powerkvm', 'mageia', 'sles', 'exherbo', 'debian', 'scientific', 'oracle', 'android', 'wsl2', 'raspbian', 'altlinux', 'ubuntu', 'parallels', 'fedora'}))ΒΆ
Sum of all Linux distributions and Linux compatibility layers.
- extra_platforms.groups.SYSTEM_V = Group(id='system_v', name='Any Unix derived from AT&T System Five', platform_ids=frozenset({'aix', 'solaris'}))ΒΆ
All Unix platforms derived from AT&T System Five.
Note
Are considered of this family (according Wikipedia):
A/UX
AIX
HP-UX
IRIX
OpenServer
Solaris
OpenSolaris
Illumos
Tru64
UNIX
UnixWare
- extra_platforms.groups.UNIX_LAYERS = Group(id='unix_layers', name='Any Unix compatibility layers', platform_ids=frozenset({'cygwin'}))ΒΆ
Interfaces that allows Unix binaries to run on a different host system.
Note
Are considered of this family (according Wikipedia):
Cygwin
Darling
Eunice
GNV
Interix
MachTen
Microsoft POSIX subsystem
MKS Toolkit
PASE
P.I.P.S.
PWS/VSE-AF
UNIX System Services
UserLAnd Technologies
Windows Services for UNIX
- extra_platforms.groups.OTHER_UNIX = Group(id='other_unix', name='Any other Unix', platform_ids=frozenset({'hurd'}))ΒΆ
All other Unix platforms.
Note
Are considered of this family (according Wikipedia):
Coherent
GNU/Hurd
HarmonyOS
LiteOS
LynxOS
Minix
MOS
OSF/1
QNX
BlackBerry 10
Research Unix
SerenityOS
- extra_platforms.groups.NON_OVERLAPPING_GROUPS: frozenset[Group] = frozenset({Group(id='any_windows', name='Any Windows', platform_ids=frozenset({'windows'})), Group(id='bsd', name='Any BSD', platform_ids=frozenset({'macos', 'sunos', 'freebsd', 'openbsd', 'netbsd', 'midnightbsd'})), Group(id='linux', name='Any Linux distribution', platform_ids=frozenset({'linuxmint', 'gentoo', 'unknown_linux', 'slackware', 'mandriva', 'rocky', 'ibm_powerkvm', 'mageia', 'arch', 'kvmibm', 'opensuse', 'sles', 'exherbo', 'buildroot', 'centos', 'debian', 'scientific', 'amzn', 'oracle', 'android', 'xenserver', 'fedora', 'raspbian', 'altlinux', 'ubuntu', 'guix', 'parallels', 'rhel', 'cloudlinux', 'pidora'})), Group(id='linux_layers', name='Any Linux compatibility layers', platform_ids=frozenset({'wsl2', 'wsl1'})), Group(id='other_unix', name='Any other Unix', platform_ids=frozenset({'hurd'})), Group(id='system_v', name='Any Unix derived from AT&T System Five', platform_ids=frozenset({'aix', 'solaris'})), Group(id='unix_layers', name='Any Unix compatibility layers', platform_ids=frozenset({'cygwin'}))})ΒΆ
Non-overlapping groups.
- extra_platforms.groups.EXTRA_GROUPS: frozenset[Group] = frozenset({Group(id='all_platforms', name='All platforms', platform_ids=frozenset({'linuxmint', 'gentoo', 'unknown_linux', 'freebsd', 'slackware', 'netbsd', 'rocky', 'wsl1', 'midnightbsd', 'arch', 'kvmibm', 'opensuse', 'openbsd', 'buildroot', 'centos', 'amzn', 'xenserver', 'sunos', 'guix', 'hurd', 'cloudlinux', 'pidora', 'rhel', 'windows', 'mandriva', 'ibm_powerkvm', 'mageia', 'aix', 'sles', 'exherbo', 'debian', 'scientific', 'macos', 'oracle', 'solaris', 'android', 'wsl2', 'raspbian', 'cygwin', 'altlinux', 'ubuntu', 'parallels', 'fedora'})), Group(id='bsd_without_macos', name='Any BSD but macOS', platform_ids=frozenset({'sunos', 'freebsd', 'openbsd', 'netbsd', 'midnightbsd'})), Group(id='linux_like', name='Any Linux and compatibility layers', platform_ids=frozenset({'linuxmint', 'gentoo', 'unknown_linux', 'slackware', 'rocky', 'wsl1', 'arch', 'kvmibm', 'opensuse', 'buildroot', 'centos', 'amzn', 'xenserver', 'guix', 'rhel', 'cloudlinux', 'pidora', 'mandriva', 'ibm_powerkvm', 'mageia', 'sles', 'exherbo', 'debian', 'scientific', 'oracle', 'android', 'wsl2', 'raspbian', 'altlinux', 'ubuntu', 'parallels', 'fedora'})), Group(id='unix', name='Any Unix', platform_ids=frozenset({'linuxmint', 'gentoo', 'unknown_linux', 'freebsd', 'slackware', 'netbsd', 'rocky', 'wsl1', 'midnightbsd', 'arch', 'kvmibm', 'opensuse', 'openbsd', 'buildroot', 'centos', 'amzn', 'xenserver', 'sunos', 'guix', 'hurd', 'cloudlinux', 'pidora', 'rhel', 'mandriva', 'ibm_powerkvm', 'mageia', 'aix', 'sles', 'exherbo', 'debian', 'scientific', 'macos', 'oracle', 'solaris', 'android', 'wsl2', 'raspbian', 'cygwin', 'altlinux', 'ubuntu', 'parallels', 'fedora'})), Group(id='unix_without_macos', name='Any Unix but macOS', platform_ids=frozenset({'linuxmint', 'gentoo', 'unknown_linux', 'freebsd', 'slackware', 'netbsd', 'rocky', 'wsl1', 'midnightbsd', 'arch', 'kvmibm', 'opensuse', 'openbsd', 'buildroot', 'centos', 'amzn', 'xenserver', 'sunos', 'guix', 'hurd', 'cloudlinux', 'pidora', 'rhel', 'mandriva', 'ibm_powerkvm', 'mageia', 'aix', 'sles', 'exherbo', 'debian', 'scientific', 'oracle', 'solaris', 'android', 'wsl2', 'raspbian', 'cygwin', 'altlinux', 'ubuntu', 'parallels', 'fedora'}))})ΒΆ
Overlapping groups, defined for convenience.
- extra_platforms.groups.ALL_GROUPS: frozenset[Group] = frozenset({Group(id='all_platforms', name='All platforms', platform_ids=frozenset({'linuxmint', 'gentoo', 'unknown_linux', 'freebsd', 'slackware', 'netbsd', 'rocky', 'wsl1', 'midnightbsd', 'arch', 'kvmibm', 'opensuse', 'openbsd', 'buildroot', 'centos', 'amzn', 'xenserver', 'sunos', 'guix', 'hurd', 'cloudlinux', 'pidora', 'rhel', 'windows', 'mandriva', 'ibm_powerkvm', 'mageia', 'aix', 'sles', 'exherbo', 'debian', 'scientific', 'macos', 'oracle', 'solaris', 'android', 'wsl2', 'raspbian', 'cygwin', 'altlinux', 'ubuntu', 'parallels', 'fedora'})), Group(id='any_windows', name='Any Windows', platform_ids=frozenset({'windows'})), Group(id='bsd', name='Any BSD', platform_ids=frozenset({'macos', 'sunos', 'freebsd', 'openbsd', 'netbsd', 'midnightbsd'})), Group(id='bsd_without_macos', name='Any BSD but macOS', platform_ids=frozenset({'sunos', 'freebsd', 'openbsd', 'netbsd', 'midnightbsd'})), Group(id='linux', name='Any Linux distribution', platform_ids=frozenset({'linuxmint', 'gentoo', 'unknown_linux', 'slackware', 'mandriva', 'rocky', 'ibm_powerkvm', 'mageia', 'arch', 'kvmibm', 'opensuse', 'sles', 'exherbo', 'buildroot', 'centos', 'debian', 'scientific', 'amzn', 'oracle', 'android', 'xenserver', 'fedora', 'raspbian', 'altlinux', 'ubuntu', 'guix', 'parallels', 'rhel', 'cloudlinux', 'pidora'})), Group(id='linux_layers', name='Any Linux compatibility layers', platform_ids=frozenset({'wsl2', 'wsl1'})), Group(id='linux_like', name='Any Linux and compatibility layers', platform_ids=frozenset({'linuxmint', 'gentoo', 'unknown_linux', 'slackware', 'rocky', 'wsl1', 'arch', 'kvmibm', 'opensuse', 'buildroot', 'centos', 'amzn', 'xenserver', 'guix', 'rhel', 'cloudlinux', 'pidora', 'mandriva', 'ibm_powerkvm', 'mageia', 'sles', 'exherbo', 'debian', 'scientific', 'oracle', 'android', 'wsl2', 'raspbian', 'altlinux', 'ubuntu', 'parallels', 'fedora'})), Group(id='other_unix', name='Any other Unix', platform_ids=frozenset({'hurd'})), Group(id='system_v', name='Any Unix derived from AT&T System Five', platform_ids=frozenset({'aix', 'solaris'})), Group(id='unix', name='Any Unix', platform_ids=frozenset({'linuxmint', 'gentoo', 'unknown_linux', 'freebsd', 'slackware', 'netbsd', 'rocky', 'wsl1', 'midnightbsd', 'arch', 'kvmibm', 'opensuse', 'openbsd', 'buildroot', 'centos', 'amzn', 'xenserver', 'sunos', 'guix', 'hurd', 'cloudlinux', 'pidora', 'rhel', 'mandriva', 'ibm_powerkvm', 'mageia', 'aix', 'sles', 'exherbo', 'debian', 'scientific', 'macos', 'oracle', 'solaris', 'android', 'wsl2', 'raspbian', 'cygwin', 'altlinux', 'ubuntu', 'parallels', 'fedora'})), Group(id='unix_layers', name='Any Unix compatibility layers', platform_ids=frozenset({'cygwin'})), Group(id='unix_without_macos', name='Any Unix but macOS', platform_ids=frozenset({'linuxmint', 'gentoo', 'unknown_linux', 'freebsd', 'slackware', 'netbsd', 'rocky', 'wsl1', 'midnightbsd', 'arch', 'kvmibm', 'opensuse', 'openbsd', 'buildroot', 'centos', 'amzn', 'xenserver', 'sunos', 'guix', 'hurd', 'cloudlinux', 'pidora', 'rhel', 'mandriva', 'ibm_powerkvm', 'mageia', 'aix', 'sles', 'exherbo', 'debian', 'scientific', 'oracle', 'solaris', 'android', 'wsl2', 'raspbian', 'cygwin', 'altlinux', 'ubuntu', 'parallels', 'fedora'}))})ΒΆ
All groups.
- extra_platforms.groups.reduce(items)[source]ΒΆ
Reduce a collection of
Group
andPlatform
to a minimal set.Returns a deduplicated set of
Group
andPlatform
that covers the same exact platforms as the original input, but group as much platforms as possible, to reduce the number of items. :rtype:set
[Group
|Platform
]Hint
Maybe this could be solved with some Euler diagram algorithms, like those implemented in eule.
This is being discussed upstream at trouchet/eule#120.
Todo
Should we rename or alias this method to collapse()? Cannot decide if it is more descriptive or notβ¦
extra_platforms.platforms moduleΒΆ
Platform definitions and metadata.
Everything here can be aggressively cached and frozen, as itβs only compute platform-dependent values.
Note
Default icons are inspired from Starship project: - https://starship.rs/config/#os - https://github.com/davidkna/starship/blob/e9faf17/.github/config-schema.json#L1221-L1269
- class extra_platforms.platforms.Platform(id, name, icon='β')[source]ΒΆ
Bases:
object
A platform can identify multiple distributions or OSes with the same characteristics.
It has a unique ID, a human-readable name, and boolean to flag current platform.
- extra_platforms.platforms.XENSERVER = Platform(id='xenserver', name='XenServer', current=False)ΒΆ
All individual platforms.
extra_platforms.pytest moduleΒΆ
Pytest decorators to skip tests depending on the platform theyβre run on.
- extra_platforms.pytest.skip_linux(*args, **kwargs) = MarkDecorator(mark=Mark(name='skipif', args=(True,), kwargs={'reason': 'Skip Linux'}))ΒΆ
Pytest mark to skip a test if run on a Linux system.
- extra_platforms.pytest.skip_macos(*args, **kwargs) = MarkDecorator(mark=Mark(name='skipif', args=(False,), kwargs={'reason': 'Skip macOS'}))ΒΆ
Pytest mark to skip a test if run on a macOS system.
- extra_platforms.pytest.skip_windows(*args, **kwargs) = MarkDecorator(mark=Mark(name='skipif', args=(False,), kwargs={'reason': 'Skip Windows'}))ΒΆ
Pytest mark to skip a test if run on a Windows system.
- extra_platforms.pytest.unless_linux(*args, **kwargs) = MarkDecorator(mark=Mark(name='skipif', args=(False,), kwargs={'reason': 'Linux required'}))ΒΆ
Pytest mark to skip a test unless it is run on a Linux system.
- extra_platforms.pytest.unless_macos(*args, **kwargs) = MarkDecorator(mark=Mark(name='skipif', args=(True,), kwargs={'reason': 'macOS required'}))ΒΆ
Pytest mark to skip a test unless it is run on a macOS system.
- extra_platforms.pytest.unless_windows(*args, **kwargs) = MarkDecorator(mark=Mark(name='skipif', args=(True,), kwargs={'reason': 'Windows required'}))ΒΆ
Pytest mark to skip a test unless it is run on a Windows system.