GroupsĀ¶

extra_platforms.group APIĀ¶

Group models collection of platforms. Also referred as families or categories.

class extra_platforms.group.Group(id, name, icon='ā“', platforms=<factory>)[source]Ā¶

Bases: object

A Group identify a collection of Platform.

Used to group platforms of the same family.

set-like methods are available and performed on the platform objects the group contains (in the self.platforms data field).

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.

isdisjoint(other)[source]Ā¶

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

Groups are disjoint if and only if their intersection is an empty set.

other can be an arbitrarily nested Iterable of Group and Platform.

Return type:

bool

fullyintersects(other)[source]Ā¶

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

Return type:

bool

issubset(other)[source]Ā¶

Test whether every platforms in the group is in other.

Return type:

bool

issuperset(other)[source]Ā¶

Test whether every platform in other is in the group.

Return type:

bool

union(*others)[source]Ā¶

Return a new Group with platforms from the group and all others.

Return type:

Group

..caution::

The new Group will inherits the metadata of the first one. All other groupsā€™ metadata will be ignored.

intersection(*others)[source]Ā¶

Return a new Group with platforms common to the group and all others.

Return type:

Group

..caution::

The new Group will inherits the metadata of the first one. All other groupsā€™ metadata will be ignored.

difference(*others)[source]Ā¶

Return a new Group with platforms in the group that are not in the others.

Return type:

Group

..caution::

The new Group will inherits the metadata of the first one. All other groupsā€™ metadata will be ignored.

symmetric_difference(other)[source]Ā¶

Return a new Group with platforms in either the group or other but not both.

Return type:

Group

..caution::

The new Group will inherits the metadata of the first one. All other groupsā€™ metadata will be ignored.

copy(id=None, name=None, icon=None, platforms=None)[source]Ā¶

Return a shallow copy of the group.

Fields can be overridden by passing new values as arguments.

Return type:

Group

extra_platforms.group.reduce(items, target_pool=None)[source]Ā¶

Reduce a collection of platforms 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.

Only the groups defined in the target_pool are considered for the reduction. If no reference pool is provided, use all known groups. :rtype: frozenset[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.group_data APIĀ¶

Definitions of ready-to-use groups.

extra_platforms.group_data.ALL_PLATFORMS: Group = Group(id='all_platforms', name='All platforms', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'macos', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'windows', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'}))Ā¶

All recognized platforms.

extra_platforms.group_data.ANY_WINDOWS = Group(id='any_windows', name='Any Windows', platform_ids=frozenset({'windows'}))Ā¶

All Windows operating systems.

extra_platforms.group_data.UNIX = Group(id='unix', name='Any Unix', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'macos', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'}))Ā¶

All Unix-like operating systems and compatibility layers.

extra_platforms.group_data.UNIX_WITHOUT_MACOS = Group(id='unix_without_macos', name='Any Unix but macOS', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'}))Ā¶

All Unix platforms, without macOS.

This is useful to avoid macOS-specific workarounds on Unix platforms.

extra_platforms.group_data.BSD = Group(id='bsd', name='Any BSD', platform_ids=frozenset({'freebsd', 'netbsd', 'openbsd', 'sunos', 'midnightbsd', 'macos'}))Ā¶

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.group_data.BSD_WITHOUT_MACOS = Group(id='bsd_without_macos', name='Any BSD but macOS', platform_ids=frozenset({'freebsd', 'netbsd', 'openbsd', 'midnightbsd', 'sunos'}))Ā¶

All BSD platforms, without macOS.

This is useful to avoid macOS-specific workarounds on BSD platforms.

extra_platforms.group_data.LINUX = Group(id='linux', name='Any Linux distribution', platform_ids=frozenset({'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'raspbian', 'oracle', 'scientific', 'mageia', 'ubuntu', 'kvmibm', 'tuxedo', 'pidora', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'guix', 'gentoo', 'centos', 'fedora', 'slackware', 'android', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'debian', 'xenserver'}))Ā¶

All distributions based on a Linux kernel.

Note

Are considered of this family (according Wikipedia):

  • Android

  • ChromeOS

  • any other distribution

extra_platforms.group_data.LINUX_LAYERS = Group(id='linux_layers', name='Any Linux compatibility layers', platform_ids=frozenset({'wsl1', 'wsl2'}))Ā¶

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.group_data.LINUX_LIKE = Group(id='linux_like', name='Any Linux and compatibility layers', platform_ids=frozenset({'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'raspbian', 'oracle', 'scientific', 'mageia', 'ubuntu', 'kvmibm', 'tuxedo', 'pidora', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'guix', 'wsl2', 'gentoo', 'centos', 'fedora', 'slackware', 'android', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'}))Ā¶

Sum of all Linux distributions and Linux compatibility layers.

extra_platforms.group_data.SYSTEM_V = Group(id='system_v', name='Any Unix derived from AT&T System Five', platform_ids=frozenset({'solaris', 'aix'}))Ā¶

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.group_data.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.group_data.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.group_data.NON_OVERLAPPING_GROUPS: frozenset[Group] = frozenset({Group(id='system_v', name='Any Unix derived from AT&T System Five', platform_ids=frozenset({'solaris', 'aix'})), Group(id='other_unix', name='Any other Unix', platform_ids=frozenset({'hurd'})), Group(id='linux_layers', name='Any Linux compatibility layers', platform_ids=frozenset({'wsl1', 'wsl2'})), Group(id='any_windows', name='Any Windows', platform_ids=frozenset({'windows'})), Group(id='bsd', name='Any BSD', platform_ids=frozenset({'freebsd', 'netbsd', 'openbsd', 'sunos', 'midnightbsd', 'macos'})), Group(id='linux', name='Any Linux distribution', platform_ids=frozenset({'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'raspbian', 'oracle', 'scientific', 'mageia', 'ubuntu', 'kvmibm', 'tuxedo', 'pidora', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'guix', 'gentoo', 'centos', 'fedora', 'slackware', 'android', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'debian', 'xenserver'})), Group(id='unix_layers', name='Any Unix compatibility layers', platform_ids=frozenset({'cygwin'}))})Ā¶

Non-overlapping groups.

extra_platforms.group_data.EXTRA_GROUPS: frozenset[Group] = frozenset({Group(id='bsd_without_macos', name='Any BSD but macOS', platform_ids=frozenset({'freebsd', 'netbsd', 'openbsd', 'midnightbsd', 'sunos'})), Group(id='linux_like', name='Any Linux and compatibility layers', platform_ids=frozenset({'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'raspbian', 'oracle', 'scientific', 'mageia', 'ubuntu', 'kvmibm', 'tuxedo', 'pidora', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'guix', 'wsl2', 'gentoo', 'centos', 'fedora', 'slackware', 'android', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'})), Group(id='unix_without_macos', name='Any Unix but macOS', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'})), Group(id='unix', name='Any Unix', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'macos', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'})), Group(id='all_platforms', name='All platforms', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'macos', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'windows', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'}))})Ā¶

Overlapping groups, defined for convenience.

extra_platforms.group_data.ALL_GROUPS: frozenset[Group] = frozenset({Group(id='linux_like', name='Any Linux and compatibility layers', platform_ids=frozenset({'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'raspbian', 'oracle', 'scientific', 'mageia', 'ubuntu', 'kvmibm', 'tuxedo', 'pidora', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'guix', 'wsl2', 'gentoo', 'centos', 'fedora', 'slackware', 'android', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'})), Group(id='system_v', name='Any Unix derived from AT&T System Five', platform_ids=frozenset({'solaris', 'aix'})), Group(id='other_unix', name='Any other Unix', platform_ids=frozenset({'hurd'})), Group(id='linux_layers', name='Any Linux compatibility layers', platform_ids=frozenset({'wsl1', 'wsl2'})), Group(id='any_windows', name='Any Windows', platform_ids=frozenset({'windows'})), Group(id='bsd_without_macos', name='Any BSD but macOS', platform_ids=frozenset({'freebsd', 'netbsd', 'openbsd', 'midnightbsd', 'sunos'})), Group(id='bsd', name='Any BSD', platform_ids=frozenset({'freebsd', 'netbsd', 'openbsd', 'sunos', 'midnightbsd', 'macos'})), Group(id='linux', name='Any Linux distribution', platform_ids=frozenset({'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'raspbian', 'oracle', 'scientific', 'mageia', 'ubuntu', 'kvmibm', 'tuxedo', 'pidora', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'guix', 'gentoo', 'centos', 'fedora', 'slackware', 'android', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'debian', 'xenserver'})), 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({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'})), Group(id='unix', name='Any Unix', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'macos', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'})), Group(id='all_platforms', name='All platforms', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'macos', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'windows', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'}))})Ā¶

All groups.