pyTooling.Platform

Common platform information gathered from various sources.

Hint

See high-level help for explanations and usage examples.

Classes


Classes

class pyTooling.Platform.PythonImplementation(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[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_()

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)
class pyTooling.Platform.PythonVersion[source]

Inheritance

Inheritance diagram of PythonVersion

__init__()[source]
Return type:

None

__eq__(other)[source]

Compare two Version instances (version numbers) for equality.

Parameters:

other – Parameter to compare against.

Returns:

True, if both version numbers are equal.

Raises:

TypeError – If parameter other is not of type SemanticVersion.

class property HasClassAttributes: bool

Check if class has Attributes.

Returns:

True, if the class has Attributes.

class property HasMethodAttributes: bool

Check if class has any method with Attributes.

Returns:

True, if the class has any method with Attributes.

__ge__(other)

Compare two Version instances (version numbers) if the version is greater than or equal to the second operand.

Parameters:

other (Any) – Parameter to compare against.

Return type:

bool

Returns:

True, if version is greater than or equal to the second operand.

Raises:

TypeError – If parameter other is not of type SemanticVersion.

__gt__(other)

Compare two Version instances (version numbers) if the version is greater than the second operand.

Parameters:

other (Any) – Parameter to compare against.

Return type:

bool

Returns:

True, if version is greater than the second operand.

Raises:

TypeError – If parameter other is not of type SemanticVersion.

__hash__ = None
__le__(other)

Compare two Version instances (version numbers) if the version is less than or equal to the second operand.

Parameters:

other (Any) – Parameter to compare against.

Return type:

bool

Returns:

True, if version is less than or equal to the second operand.

Raises:

TypeError – If parameter other is not of type SemanticVersion.

__lt__(other)

Compare two Version instances (version numbers) if the version is less than the second operand.

Parameters:

other (Any) – Parameter to compare against.

Return type:

bool

Returns:

True, if version is less than the second operand.

Raises:

TypeError – If parameter other is not of type SemanticVersion.

__ne__(other)

Compare two Version instances (version numbers) for inequality.

Parameters:

other (Any) – Parameter to compare against.

Return type:

bool

Returns:

True, if both version numbers are not equal.

Raises:

TypeError – If parameter other is not of type SemanticVersion.

__repr__()

Return a string representation of this version number without prefix v.

Return type:

str

Returns:

Raw version number representation without a prefix.

__str__()

Return a string representation of this version number with prefix v.

Return type:

str

Returns:

Version number representation including a prefix.

_build: int

Build number part of the version number.

_flags: int

State if the version in a working directory is clean or dirty compared to a tagged version.

_major: int

Major number part of the version number.

_minor: int

Minor number part of the version number.

_parts: Parts

Integer flag enumeration of present parts in a version number.

_patch: int

Patch number part of the version number.

_post: int

Post-release version number part.

_postfix: str

Postfix string

_pre: int

Pre-release version number part.

_prefix: str

Prefix string

class pyTooling.Platform.Platforms(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Inheritance

Inheritance diagram of Platforms

OS_BSD = 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.

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 = 2116

Group: native macOS on x86-64.

Windows = 2168

Group: native Windows on x86-64.

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_()

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)
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 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 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 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 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.

class property HasClassAttributes: bool

Check if class has Attributes.

Returns:

True, if the class has Attributes.

class property HasMethodAttributes: bool

Check if class has any method with Attributes.

Returns:

True, if the class has any method with Attributes.

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.

  • Linux: "" (empty string)

  • macOS: "" (empty string)

  • Windows: "exe"

property SharedLibraryExtension: str

Returns the file extension for a shared library.

  • Linux: "so"

  • macOS: "lib"

  • Windows: "dll"

__repr__()[source]

Return repr(self).

Return type:

str

__str__()[source]

Return str(self).

Return type:

str