platform

Module Contents

Classes

Platform

Class that allow user to retrieve os/cpu specific information.

Attributes

KNOWLEDGE_BASE

platform.KNOWLEDGE_BASE
class platform.Platform

Bases: collections.namedtuple('Platform', ['cpu', 'os', 'is_hie', 'platform', 'triplet', 'machine', 'domain', 'is_host', 'is_default'])

Class that allow user to retrieve os/cpu specific information.

Attributes are:

  • cpu: CPU information

  • os: Operating System information

  • is_hie: whether the system is a high integrity system

  • platform: the platform name, e.g. arm-elf-linux

  • triplet: the GCC target

  • machine: machine name

  • domain: domain name

  • is_host: True if the instance represent information for the current

    machine

  • is_default: True if the platform is the default one

default_arch: Platform | None
system_info
__slots__ = ()
classmethod get(platform_name: str | None = None, version: str | None = None, machine: str | None = None, mode: str | None = None, compute_default: bool = False) Platform

Return a Platform object.

Parameters:
  • platform_name – if None or empty then automatically detect current platform (native). Otherwise should be a valid platform string.

  • version – if None, assume default OS version or find it automatically (native case only). Otherwise should be a valid version string.

  • machine – name of the machine

  • compute_default – if True compute the default Arch for the current machine (this parameter is for internal purpose only).

  • mode – an os mode (ex: rtp for vxworks)

to_dict() dict[str, Any]

Export os and cpu variables as os_{var} and cpu_{var}.

Returns:

a dictionary representing the current Arch instance

__str__() str

Return a representation string of the object.