bundle.core.platform

Attributes

Classes

ProcessCommand

Represents a single platform-specific shell command and its result.

ProcessCommands

Represents a collection of platform-specific commands to be executed.

PlatformSpecific

Abstract base class for platform-specific data models.

Darwin

Data model for macOS (Darwin) platform-specific information.

Platform

Represents the current platform's system and Python environment information.

Module Contents

class bundle.core.platform.ProcessCommand(/, **data: Any)[source]

Bases: bundle.core.data.Data

Represents a single platform-specific shell command and its result.

name

The identifier for the command.

Type:

str

command

The shell command to execute.

Type:

str

result

The output/result of the executed command.

Type:

str

name: str
command: str
result: str = None
async run()[source]

Execute the shell command asynchronously and store its output in result.

Returns:

None

Raises:

ProcessError – If the command execution fails.

class bundle.core.platform.ProcessCommands(/, **data: Any)[source]

Bases: bundle.core.data.Data

Represents a collection of platform-specific commands to be executed.

commands

List of ProcessCommand instances.

Type:

list[ProcessCommand]

commands: list[ProcessCommand] = None
async run() ProcessCommands[source]

Execute all contained platform commands asynchronously.

Returns:

The instance with updated results for each command.

Return type:

ProcessCommands

class bundle.core.platform.PlatformSpecific(/, **data: Any)[source]

Bases: bundle.core.data.Data

Abstract base class for platform-specific data models.

target

The platform target identifier (e.g., ‘darwin’, ‘linux’).

Type:

str

target: str = None
classmethod platform_commands() ProcessCommands[source]
Abstractmethod:

Return a ProcessCommands instance with platform-specific commands.

Returns:

The commands to be executed for this platform.

Return type:

ProcessCommands

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod resolve() PlatformSpecific[source]

Resolve and instantiate the platform-specific data model by running its commands.

Returns:

An instance populated with command results.

Return type:

PlatformSpecific

class bundle.core.platform.Darwin(/, **data: Any)[source]

Bases: PlatformSpecific

Data model for macOS (Darwin) platform-specific information.

product_version

macOS product version.

Type:

str

build_version

macOS build version.

Type:

str

kernel_version

Kernel version.

Type:

str

hardware_model

Hardware model identifier.

Type:

str

hardware_uuid

Hardware UUID.

Type:

str

xcode_version

Xcode version installed.

Type:

str

command_line_tools_version

Command Line Tools version.

Type:

str

product_version: str = None
build_version: str = None
kernel_version: str = None
hardware_model: str = None
hardware_uuid: str = None
xcode_version: str = None
command_line_tools_version: str = None
macosx_deployment_target: float = None
classmethod platform_commands() Darwin[source]

Return the set of commands required to gather Darwin/macOS-specific information.

Returns:

The commands to be executed for Darwin.

Return type:

ProcessCommands

class bundle.core.platform.Platform(/, **data: Any)[source]

Bases: bundle.core.entity.Entity

Represents the current platform’s system and Python environment information.

system

The operating system name (lowercase).

Type:

str

node

The network name (hostname) of the machine.

Type:

str

release

The system’s release version.

Type:

str

version

The system’s version.

Type:

str

arch

The machine architecture.

Type:

str

processor

The processor identifier.

Type:

str

python_version

The Python version in use.

Type:

str

python_implementation

The Python implementation (e.g., CPython).

Type:

str

python_executable

The path to the Python executable.

Type:

str

python_compiler

The Python compiler used.

Type:

str

cwd

The current working directory.

Type:

Path

home

The user’s home directory.

Type:

Path

env

The environment variables.

Type:

dict

is_64bits

Whether the Python interpreter is 64-bit.

Type:

bool

pid

The current process ID.

Type:

int

uid

The current user ID (if available).

Type:

int | None

gid

The current group ID (if available).

Type:

int | None

darwin

Darwin-specific platform information (if on macOS).

Type:

Darwin | None

system: str = None
node: str = None
release: str = None
version: str = None
arch: str = None
processor: str = None
python_version: str = None
python_implementation: str = None
python_executable: str = None
python_compiler: str = None
cwd: pathlib.Path = None
home: pathlib.Path = None
env: dict = None
is_64bits: bool = None
pid: int = None
uid: None | int = None
gid: None | int = None
darwin: None | Darwin = None
property platform_string: str

Return a string summarizing the platform and Python environment.

Returns:

A string in the format “{system}-{machine}-{python_implementation}{python_version}”.

Return type:

str

property is_windows: bool

Check if the current system is Windows.

Returns:

True if Windows, False otherwise.

Return type:

bool

property is_linux: bool

Check if the current system is Linux.

Returns:

True if Linux, False otherwise.

Return type:

bool

property is_darwin: bool

Check if the current system is Darwin (macOS).

Returns:

True if Darwin, False otherwise.

Return type:

bool

bundle.core.platform.platform_info