craft_parts.plugins.base module¶
Plugin base class and definitions.
- class craft_parts.plugins.base.JavaPlugin(*, properties, part_info)[source]¶
Bases:
Plugin
A base class for java-related plugins.
Provide common methods to deal with the java executable location and symlink creation.
- Parameters:
properties (
PluginProperties
) –part_info (
PartInfo
) –
- properties_class: Type[PluginProperties]¶
- 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
- class craft_parts.plugins.base.PluginModel(**data)[source]¶
Bases:
PluginPropertiesModel
Model for plugins using pydantic validation.
Plugins with configuration properties can use pydantic validation to unmarshal data from part specs. In this case, extract plugin-specific properties using the
extract_plugin_properties()
helper.- Parameters:
data (
Any
) –
- craft_parts.plugins.base.extract_plugin_properties(data, *, plugin_name, required=None)[source]¶
Obtain plugin-specifc entries from part properties.
- Parameters:
data (
Dict
[str
,Any
]) – A dictionary containing all part properties.plugin_name (
str
) –required (
Optional
[List
[str
]]) –
- Plugin_name:
The name of the plugin.
- Return type:
Dict
[str
,Any
]- Returns:
A dictionary with plugin properties.