craft_parts.executor.environment module

Helpers to handle part environment setting.

craft_parts.executor.environment.expand_environment(data, *, info, skip=None)[source]

Replace global variables with their values.

Global variables are defined by craft-parts and are the subset of the CRAFT_* step execution environment variables that don’t depend on the part or step being executed. The list of global variables include CRAFT_ARCH_TRIPLET, CRAFT_PROJECT_DIR, CRAFT_STAGE and CRAFT_PRIME. Additional global variables can be defined by the application using craft-parts.

  • data (Dict[str, Any]) – A dictionary whose values will have variable names expanded.

  • info (ProjectInfo) – The project information.

  • skip (Optional[List[str]]) – Keys to skip when performing expansion.

Return type:


craft_parts.executor.environment.generate_step_environment(*, part, plugin, step_info)[source]

Generate an environment to use during step execution.

  • part (Part) – The part being processed.

  • plugin (Plugin) – The plugin used to build this part.

  • step_info (StepInfo) – Information about the step to be executed.

Return type:



The environment to use when executing the step.