pyTooling.Platform

Common platform information gathered from various sources.

Hint

See high-level help for explanations and usage examples.

Variables

Exceptions

Classes


Variables

pyTooling.Platform.CurrentPlatform

Gathered information for the current platform.

Platforms.Linux

Exceptions

exception pyTooling.Platform.PlatformException[source]

Base-exception of all exceptions raised by pyTooling.Platform.

Inheritance

Inheritance diagram of PlatformException

classmethod __new__(*args, **kwargs)
__init__(*args, **kwargs)
exception pyTooling.Platform.UnknownPlatformException[source]

The exception is raised by pyTooling.Platform when the platform can’t be determined.

For debugging purposes, a list of system properties from various APIs is added as notes to this exception to ease debugging unknown or new platforms.

Inheritance

Inheritance diagram of UnknownPlatformException

__init__(*args)[source]

Initialize a new UnknownPlatformException instance and add notes with further debugging information.

Parameters:

args – Forward positional parameters.

Return type:

None

classmethod __new__(*args, **kwargs)
exception pyTooling.Platform.UnknownOperatingSystemException[source]

The exception is raised by pyTooling.Platform when the operating system is unknown.

Inheritance

Inheritance diagram of UnknownOperatingSystemException

classmethod __new__(*args, **kwargs)
__init__(*args, **kwargs)

Classes

class pyTooling.Platform.PythonImplementation[source]

Inheritance

Inheritance diagram of PythonImplementation

static _generate_next_value_(name, start, count, last_values)

Generate the next value when not given.

name: the name of the member start: the initial start value or None count: the number of existing members last_values: the last value assigned or None

_numeric_repr_(obj, /)

Return the canonical string representation of the object.

For many object types, including most builtins, eval(repr(obj)) == obj.

classmethod _iter_member_by_value_(value)

Extract all members from the value in definition (i.e. increasing value) order.

classmethod _iter_member_(value)

Extract all members from the value in definition (i.e. increasing value) order.

classmethod _iter_member_by_def_(value)

Extract all members from the value in definition order.

classmethod _missing_(value)

Create a composite member containing all canonical members present in value.

If non-member values are present, result depends on _boundary_ setting.

__contains__(other)

Returns True if self has at least the same flags set as other.

__iter__()

Returns flags in definition order.

__len__()

Return the number of members (no aliases)

__repr__()

Return repr(self).

__str__()

Return str(self).

__bool__()

classes/types should always be True.

__or__(other)

Return self|value.

__ror__(other)

Return value|self.

__new__(value)
classmethod __getitem__(name)

Return the member matching name.

class pyTooling.Platform.Platforms[source]

Inheritance

Inheritance diagram of Platforms

OS_FreeBSD = 1

Operating System: BSD (Unix).

OS_Linux = 2

Operating System: Linux.

OS_MacOS = 4

Operating System: macOS.

OS_Windows = 8

Operating System: Windows.

OperatingSystem = 15

Mask: Any operating system.

SEP_WindowsPath = 16

Seperator: Path element seperator (e.g. for directories).

SEP_WindowsValue = 32

Seperator: Value seperator in variables (e.g. for paths in PATH).

ENV_Native = 64

Environment: native.

ENV_WSL = 128

Environment: Windows System for Linux.

ENV_MSYS2 = 256

Environment: MSYS2.

ENV_Cygwin = 512

Environment: Cygwin.

Environment = 960

Mask: Any environment.

ARCH_x86_32 = 1024

Architecture: x86-32 (IA32).

ARCH_x86_64 = 2048

Architecture: x86-64 (AMD64).

ARCH_AArch64 = 4096

Architecture: AArch64 (arm64).

Arch_x86 = 3072

Mask: Any x86 architecture.

Arch_Arm = 4096

Mask: Any Arm architecture.

Architecture = 7168

Mask: Any architecture.

FreeBSD = 2113

Group: native FreeBSD on x86-64.

Linux = 2114

Group: native Linux on x86-64.

MacOS = 68

Group: native macOS.

Windows = 2168

Group: native Windows on x86-64.

MacOS_Intel = 2116

Group: native macOS on x86-64.

MacOS_ARM = 4164

Group: native macOS on aarch64.

MSYS = 8192

MSYS2 Runtime: MSYS.

MinGW32 = 16384

MSYS2 Runtime: MinGW32.

MinGW64 = 32768

MSYS2 Runtime: MinGW64.

UCRT64 = 65536

MSYS2 Runtime: UCRT64.

Clang32 = 131072

MSYS2 Runtime: Clang32.

Clang64 = 262144

MSYS2 Runtime: Clang64.

MSYS2_Runtime = 516096

Mask: Any MSYS2 runtime environment.

Windows_MSYS2_MSYS = 10504

Group: MSYS runtime running on Windows x86-64

Windows_MSYS2_MinGW32 = 18696

Group: MinGW32 runtime running on Windows x86-64

Windows_MSYS2_MinGW64 = 35080

Group: MinGW64 runtime running on Windows x86-64

Windows_MSYS2_UCRT64 = 67848

Group: UCRT64 runtime running on Windows x86-64

Windows_MSYS2_Clang32 = 133384

Group: Clang32 runtime running on Windows x86-64

Windows_MSYS2_Clang64 = 264456

Group: Clang64 runtime running on Windows x86-64

Windows_Cygwin32 = 1544

Group: 32-bit Cygwin runtime on Windows x86-64

Windows_Cygwin64 = 2568

Group: 64-bit Cygwin runtime on Windows x86-64

static _generate_next_value_(name, start, count, last_values)

Generate the next value when not given.

name: the name of the member start: the initial start value or None count: the number of existing members last_values: the last value assigned or None

_numeric_repr_(obj, /)

Return the canonical string representation of the object.

For many object types, including most builtins, eval(repr(obj)) == obj.

classmethod _iter_member_by_value_(value)

Extract all members from the value in definition (i.e. increasing value) order.

classmethod _iter_member_(value)

Extract all members from the value in definition (i.e. increasing value) order.

classmethod _iter_member_by_def_(value)

Extract all members from the value in definition order.

classmethod _missing_(value)

Create a composite member containing all canonical members present in value.

If non-member values are present, result depends on _boundary_ setting.

__contains__(other)

Returns True if self has at least the same flags set as other.

__iter__()

Returns flags in definition order.

__len__()

Return the number of members (no aliases)

__repr__()

Return repr(self).

__str__()

Return str(self).

__bool__()

classes/types should always be True.

__or__(other)

Return self|value.

__ror__(other)

Return value|self.

__new__(value)
classmethod __getitem__(name)

Return the member matching name.

class pyTooling.Platform.Platform[source]

An instance of this class contains all gathered information available from various sources.

See also

StackOverflow question: Python: What OS am I running on?

Inheritance

Inheritance diagram of Platform

__init__()[source]
Return type:

None

property IsCPython: bool

Returns true, if the Python implementation is a CPython.

Returns:

True, if the Python implementation is CPython.

property IsPyPy: bool

Returns true, if the Python implementation is a PyPy.

Returns:

True, if the Python implementation is PyPY.

property IsNativePlatform: bool

Returns true, if the platform is a native platform.

Returns:

True, if the platform is a native platform.

property IsNativeFreeBSD: bool

Returns true, if the platform is a native FreeBSD x86-64 platform.

Returns:

True, if the platform is a native FreeBSD x86-64 platform.

property IsNativeMacOS: bool

Returns true, if the platform is a native macOS x86-64 platform.

Returns:

True, if the platform is a native macOS x86-64 platform.

property IsNativeLinux: bool

Returns true, if the platform is a native Linux x86-64 platform.

Returns:

True, if the platform is a native Linux x86-64 platform.

property IsNativeWindows: bool

Returns true, if the platform is a native Windows x86-64 platform.

Returns:

True, if the platform is a native Windows x86-64 platform.

property IsMSYS2Environment: bool

Returns true, if the platform is a MSYS2 environment on Windows.

Returns:

True, if the platform is a MSYS2 environment on Windows.

property IsMSYSOnWindows: bool

Returns true, if the platform is a MSYS runtime on Windows.

Returns:

True, if the platform is a MSYS runtime on Windows.

property IsMinGW32OnWindows: bool

Returns true, if the platform is a MinGW32 runtime on Windows.

Returns:

True, if the platform is a MINGW32 runtime on Windows.

property IsMinGW64OnWindows: bool

Returns true, if the platform is a MinGW64 runtime on Windows.

Returns:

True, if the platform is a MINGW64 runtime on Windows.

property IsUCRT64OnWindows: bool

Returns true, if the platform is a UCRT64 runtime on Windows.

Returns:

True, if the platform is a UCRT64 runtime on Windows.

property IsClang32OnWindows: bool

Returns true, if the platform is a Clang32 runtime on Windows.

Returns:

True, if the platform is a Clang32 runtime on Windows.

property IsClang64OnWindows: bool

Returns true, if the platform is a Clang64 runtime on Windows.

Returns:

True, if the platform is a Clang64 runtime on Windows.

property IsCygwin32OnWindows: bool

Returns true, if the platform is a 32-bit Cygwin runtime on Windows.

Returns:

True, if the platform is a 32-bit Cygwin runtime on Windows.

property IsCygwin64OnWindows: bool

Returns true, if the platform is a 64-bit Cygwin runtime on Windows.

Returns:

True, if the platform is a 64-bit Cygwin runtime on Windows.

property IsPOSIX: bool

Returns true, if the platform is POSIX or POSIX-like.

Returns:

True, if POSIX or POSIX-like.

property PathSeperator: str

Returns the path element separation character (e.g. for directories).

  • POSIX-like: /

  • Windows: \

Returns:

Path separation character.

property ValueSeperator: str

Returns the value separation character (e.g. for paths in PATH).

  • POSIX-like: :

  • Windows: ;

Returns:

Value separation character.

property ExecutableExtension: str

Returns the file extension for an executable.

  • FreeBSD: "" (empty string)

  • Linux: "" (empty string)

  • macOS: "" (empty string)

  • Windows: "exe"

Returns:

File extension of an executable.

Raises:

UnknownOperatingSystemException – If the operating system is unknown.

property StaticLibraryExtension: str

Returns the file extension for a static library.

  • FreeBSD: "a"

  • Linux: "a"

  • macOS: "lib"

  • Windows: "lib"

Returns:

File extension of a static library.

Raises:

UnknownOperatingSystemException – If the operating system is unknown.

property DynamicLibraryExtension: str

Returns the file extension for a dynamic/shared library.

  • FreeBSD: "so"

  • Linux: "so"

  • macOS: "dylib"

  • Windows: "dll"

Returns:

File extension of a dynamic library.

Raises:

UnknownOperatingSystemException – If the operating system is unknown.

__repr__()[source]

Return repr(self).

Return type:

str

__str__()[source]

Return str(self).

Return type:

str