craft_parts.state_manager.state_manager module¶
Part crafter step state management.
- class craft_parts.state_manager.state_manager.StateManager(*, project_info, part_list, ignore_outdated=None)[source]¶
Bases:
object
Keep track of lifecycle execution state.
The State Manager tells whether a step should run based on current state information. The state database is initialized from state on disk, and after that it’s maintained only in memory.
- Parameters:
project_info (
ProjectInfo
) – The project information.part_list (
list
[Part
]) – A list of this project’s parts.ignore_outdated (
Optional
[list
[str
]]) – A list of file patterns to ignore when testing for outdated files.
- check_if_dirty(part, step)[source]¶
Verify whether a step is dirty.
A step is considered to be dirty if relevant properties or project options have changed since the step was executed. This means the step needs to be cleaned and run again. This is in contrast to an “outdated” step, which typically doesn’t need to be cleaned, just updated with files from an earlier step in the lifecycle.
- Parameters:
- Return type:
DirtyReport
|None
- Returns:
A class:DirtyReport if the step is outdated, None otherwise.
- check_if_outdated(part, step)[source]¶
Verify whether a step is outdated.
A step is considered to be outdated if an earlier step in the lifecycle has been run more recently, or if the source code changed on disk. This means the step needs to be updated by taking modified files from the previous step. This is in contrast to a “dirty” step, which must be cleaned and run again.
- Parameters:
- Return type:
OutdatedReport
|None
- Returns:
An class:OutdatedReport if the step is outdated, None otherwise.
- get_outdated_dirs(part)[source]¶
Get the list of outdated directories for this part.
- Parameters:
part (
Part
) – The part being processed.- Return type:
list
[str
] |None
- Returns:
The list of outdated directories from the part’s pull step.
- get_outdated_files(part)[source]¶
Get the list of outdated files for this part.
- Parameters:
part (
Part
) – The part being processed.- Return type:
list
[str
] |None
- Returns:
The list of outdated files from the part’s pull step.
- project_vars(part, step)[source]¶
Obtain the project variables for a given part and step.
- Parameters:
- Return type:
dict
[str
,ProjectVar
] |None
- Returns:
The project variables from the last execution.