GroupsΒΆ

extra_platforms.groups APIΒΆ

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 of Platform.

Used to group platforms of the same family.

id: strΒΆ

Unique ID of the group.

name: strΒΆ

User-friendly description of a group.

icon: str = '❓'ΒΆ

Icon of the group.

platforms: tuple[Platform, ...]ΒΆ

Sorted list of platforms that belong to this group.

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:

bool

fullyintersects(other)[source]ΒΆ

Return True if the group has all platforms in common with other.

We cannot just compare Groups with the == equality operator as the latter takes all attributes into account, as per dataclass default behavior.

Return type:

bool

issubset(other)[source]ΒΆ
Return type:

bool

issuperset(other)[source]ΒΆ
Return type:

bool

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.

Note

Are considered of this family (according Wikipedia):

  • Android

  • ChromeOS

  • any other distribution

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.

Note

Are considered of this family (according Wikipedia):

  • Windows Subsystem for Linux

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 and Platform to a minimal set.

Returns a deduplicated set of Group and Platform 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…