craft_parts.actions module

Definitions of lifecycle actions and action types.

class craft_parts.actions.Action(part_name, step, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None))[source]

Bases: object

The action to be executed for a given part.

Actions correspond to the operations required to run the lifecycle for each of the parts in the project specification.

Parameters:
  • part_name (str) – The name of the part this action will be performed on.

  • step (Step) – The Step this action will execute.

  • action_type (ActionType) – Action to run for this step.

  • reason (Optional[str]) – A textual description of why this action should be executed.

  • project_vars (Optional[dict[str, ProjectVar]]) – The values of project variables from a previous execution, used if the action type is ActionType.SKIP.

  • properties (ActionProperties)

action_type: ActionType = 0
part_name: str
project_vars: dict[str, ProjectVar] | None = None
properties: ActionProperties = ActionProperties(changed_files=None, changed_dirs=None)
reason: str | None = None
step: Step
class craft_parts.actions.ActionProperties(changed_files=None, changed_dirs=None)[source]

Bases: object

Properties defined for an action.

Parameters:
  • changed_files (Optional[list[str]])

  • changed_dirs (Optional[list[str]])

changed_dirs: list[str] | None = None
changed_files: list[str] | None = None
class craft_parts.actions.ActionType(value)[source]

Bases: IntEnum

The type of action to be executed.

Action execution can be modified according to its type:

RUN: execute the expected commands for step processing.

RERUN: clear the existing data and state before proceeding.

UPDATE: try to continue processing the step.

SKIP: don’t execute this action.

REAPPLY: run the step commands without updating its state.

REAPPLY = 4
RERUN = 1
RUN = 0
SKIP = 2
UPDATE = 3