craft_parts.plugins.base module

Plugin base class and definitions.

class craft_parts.plugins.base.BasePythonPlugin(*, properties, part_info)[source]

Bases: Plugin

A base class for Python plugins.

Provides common methods for dealing with Python items.

Parameters:
get_build_commands()[source]

Return a list of commands to run during the build step.

Return type:

list[str]

get_build_environment()[source]

Return a dictionary with the environment to use in the build step.

Child classes that need to override this should extend the dictionary returned by this class.

Return type:

dict[str, str]

get_build_packages()[source]

Return a set of required packages to install in the build environment.

Child classes that need to override this should extend the returned set.

Return type:

set[str]

get_build_snaps()[source]

Return a set of required snaps to install in the build environment.

Return type:

set[str]

class craft_parts.plugins.base.Plugin(*, properties, part_info)[source]

Bases: ABC

The base class for plugins.

Variables:
  • properties_class – The plugin properties class.

  • validator_class – The plugin environment validator class.

Parameters:
  • part_info (PartInfo) – The part information for the applicable part.

  • properties (PluginProperties) – Part-defined properties.

abstract get_build_commands()[source]

Return a list of commands to run during the build step.

Return type:

list[str]

abstract get_build_environment()[source]

Return a dictionary with the environment to use in the build step.

Return type:

dict[str, str]

abstract get_build_packages()[source]

Return a set of required packages to install in the build environment.

Return type:

set[str]

abstract get_build_snaps()[source]

Return a set of required snaps to install in the build environment.

Return type:

set[str]

classmethod get_out_of_source_build()[source]

Return whether the plugin performs out-of-source-tree builds.

Return type:

bool

get_pull_commands()[source]

Return the commands to retrieve dependencies during the pull step.

Return type:

list[str]

properties_class: type[PluginProperties]
set_action_properties(action_properties)[source]

Store a copy of the given action properties.

Parameters:

action_properties (ActionProperties) – The properties to store.

Return type:

None

supports_strict_mode = False

Plugins that can run in ‘strict’ mode must set this classvar to True.

validator_class

alias of PluginEnvironmentValidator