os.platform
¶
Provides function to detect platform specific information.
Module Contents¶
Classes¶
Gather info about the system. |
|
Object representing a CPU. |
|
Object representing an OS. |
Attributes¶
- os.platform.KNOWLEDGE_BASE¶
- os.platform.UNKNOWN = 'unknown'¶
- os.platform.Uname¶
- os.platform.logger¶
- class os.platform.SystemInfo¶
Gather info about the system.
- Variables:
uname – instance of Uname namedtuple containing the result of
uname
system call.core_number – integer containing the number of processor cores on the machine
- uname¶
- core_number = 1¶
- ld_info¶
- _platform: str | None¶
- _os_version: tuple[str, str] | None¶
- _hostname: tuple[str, str] | None¶
- classmethod reset_cache() None ¶
Reset SystemInfo cache.
- classmethod fetch_system_data() None ¶
Fetch info from the host system.
The function should be the only one that use system calls or programs to fetch information from the current system. Overriding this method should be enough for example for testing purposes as all the other methods use information retrieved in this function.
The function should set all the class attributes described at the beginning of this class.
- classmethod platform() str ¶
Guess platform name.
Internal function that guess base on uname system call the current platform
- Returns:
the platform name
- classmethod os_version() tuple[str, str] ¶
Compute OS version information.
- Returns:
a tuple containing os version and kernel version
- classmethod hostname() tuple[str, str] ¶
Get hostname and associated domain.
- Returns:
a tuple (hostname, domain)
- class os.platform.CPU¶
Bases:
namedtuple
('CPU'
, ['name'
,'bits'
,'endian'
,'cores'
])Object representing a CPU.
CPU attributes are:
name: [str] the CPU name
bits: number of bits for the cpu or ‘unknown’
endian: big, little, or unknown
cores: number of cores available
- __slots__ = ()¶
- as_dict() dict[str, Any] ¶
- class os.platform.OS¶
Bases:
namedtuple
('OS'
, ['name'
,'version'
,'kernel_version'
,'exeext'
,'dllext'
,'is_bareboard'
,'mode'
])Object representing an OS.
Attributes are:
name: the OS name
version: the OS version
kernel_version: the exact version of the kernel
exeext: the default executable extension (e.g. .exe on Windows)
dllext: the default shared library extension (e.g. .dll on Windows)
is_bareboard: whether the system has an OS or not.
- __slots__ = ()¶
- as_dict() dict[str, Any] ¶