craft_parts.state_manager.step_state module¶
The step state preserves step execution context information.
- class craft_parts.state_manager.step_state.MigrationContents(**data)¶
Bases:
BaseModelFiles and directories migrated.
- Parameters:
data (
Any)
-
directories:
set[str]¶
-
files:
set[str]¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class craft_parts.state_manager.step_state.MigrationState(**data)¶
Bases:
BaseModelState information collected when migrating steps.
The migration state contains the paths to the files and directories that have been migrated. This information is used to remove migrated files from shared areas on step cleanup.
- Parameters:
data (
Any)
- add(*, files=None, directories=None)¶
Add files and directories to migrated contents.
- Parameters:
files (
set[str] |None)directories (
set[str] |None)
- Return type:
None
- contents(partition)¶
Return migrated contents for a given partition.
- Parameters:
partition (
str|None)- Return type:
tuple[set[str],set[str]] |None
-
directories:
set[str]¶
-
files:
set[str]¶
- marshal()¶
Create a dictionary containing the part state data.
- Return type:
dict[str,Any]- Returns:
The newly created dictionary.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
partition:
str|None¶
-
partitions_contents:
dict[str,MigrationContents]¶
- classmethod unmarshal(data)¶
Create and populate a new state object from dictionary data.
- Parameters:
data (
dict[str,Any]) – A dictionary containing the data to unmarshal.- Return type:
- Returns:
The state object containing the migration data.
- write(filepath)¶
Write state data to disk.
- Parameters:
filepath (
Path) – The path to the file to write.- Return type:
None
- class craft_parts.state_manager.step_state.StepState(**data)¶
Bases:
MigrationState,ABCContextual information collected when a step is executed.
The step state contains environmental and project-specific configuration data collected at step run time. Those properties are used to decide whether the step should run again on a new lifecycle execution.
- Parameters:
data (
Any)
- diff_project_options_of_interest(other_project_options)¶
Return project options that differ.
Take a dictionary of project_options and compare to our own, returning the set of project option names that are different. Both dictionaries are filtered prior to comparison, only relevant options are compared.
- Parameters:
other_project_options (
ProjectOptions) – The project options to compare to the project options stored in this state.- Return type:
set[str]
- diff_properties_of_interest(other_properties, also_compare=None)¶
Return properties of interest that differ.
Take a dictionary of properties and compare to our own, returning the set of property names that are different. Both dictionaries are filtered prior to comparison, only relevant properties are compared.
- Parameters:
other_properties (
dict[str,Any]) – The properties to compare to the project options stored in this state.also_compare (
list[str] |None)
- Return type:
set[str]
- model_config: ClassVar[ConfigDict] = {'alias_generator': <function StepState.<lambda>>, 'extra': 'ignore', 'frozen': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
part_properties:
dict[str,Any]¶
-
project_options:
ProjectOptions¶
- abstract project_options_of_interest(project_options)¶
Return relevant project options concerning this step.
- Parameters:
project_options (
ProjectOptions)- Return type:
dict[str,Any]
- abstract properties_of_interest(part_properties, *, extra_properties=None)¶
Return relevant properties concerning this step.
- Parameters:
part_properties (
dict[str,Any])extra_properties (
list[str] |None)
- Return type:
dict[str,Any]
- craft_parts.state_manager.step_state.validate_hex_string(value)¶
Ensure that a pydantic model field is hexadecimal string.
- Parameters:
value (
str)- Return type:
str