craft_parts.executor.step_handler module

Handle the execution of built-in or user specified step commands.

class craft_parts.executor.step_handler.StepContents(files=<factory>, dirs=<factory>)[source]

Bases: object

Files and directories to be added to the step’s state.

Parameters:
  • files (set[str])

  • dirs (set[str])

dirs: set[str]
files: set[str]
class craft_parts.executor.step_handler.StepHandler(part, *, step_info, plugin, source_handler, env, stdout=None, stderr=None, partitions=None)[source]

Bases: object

Executes built-in or user-specified step commands.

The step handler takes care of the execution of a step, using either a built-in set of actions to be taken, or executing a user-defined script defined in the part specification User-defined scripts may also call the built-in handler for a step by invoking a control utility. This class implements the built-in handlers and a FIFO-based mechanism and API to be used by the external control utility to communicate with the running instance.

Parameters:
  • part (Part)

  • step_info (StepInfo)

  • plugin (Plugin)

  • source_handler (SourceHandler | None)

  • env (str)

  • stdout (Union[TextIO, int, None])

  • stderr (Union[TextIO, int, None])

  • partitions (Optional[set[str]])

run_builtin()[source]

Run the built-in commands for the current step.

Return type:

StepContents

run_scriptlet(scriptlet, *, scriptlet_name, step, work_dir)[source]

Execute a scriptlet.

Parameters:
  • scriptlet (str) – the scriptlet to run.

  • work_dir (Path) – the directory where the script will be executed.

  • scriptlet_name (str)

  • step (Step)

Return type:

None