craft_parts.plugins.meson_plugin module

The Meson plugin.

class craft_parts.plugins.meson_plugin.MesonPlugin(*, properties, part_info)[source]

Bases: Plugin

A plugin for meson projects.

The meson plugin requires meson installed on your system. This can be achieved by adding the appropriate meson package to build-packages or build-snaps, or to have it installed or built in a different part. In this case, the name of the part supplying meson must be “meson”.

The meson plugin uses the common plugin keywords as well as those for “sources”. Additionally, the following plugin-specific keywords can be used:

  • meson-parameters (list of strings) List of parameters used to configure the meson based project.

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.

Return type:

dict[str, str]

get_build_packages()[source]

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

Return type:

set[str]

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

properties_class

alias of MesonPluginProperties

validator_class

alias of MesonPluginEnvironmentValidator

class craft_parts.plugins.meson_plugin.MesonPluginEnvironmentValidator(*, part_name, env, properties)[source]

Bases: PluginEnvironmentValidator

Check the execution environment for the Meson plugin.

Parameters:
  • part_name (str) – The part whose build environment is being validated.

  • env (str) – A string containing the build step environment setup.

  • properties (PluginProperties)

validate_environment(*, part_dependencies=None)[source]

Ensure the environment contains dependencies needed by the plugin.

Parameters:

part_dependencies (Optional[list[str]]) – A list of the parts this part depends on.

Raises:

PluginEnvironmentValidationError – If the environment is invalid.

Return type:

None

class craft_parts.plugins.meson_plugin.MesonPluginProperties(**data)[source]

Bases: PluginProperties

The part properties used by the Meson plugin.

Parameters:

data (Any)

meson_parameters: list[str]
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'alias_generator': <function PluginProperties.<lambda>>, 'extra': 'forbid', 'frozen': True, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'meson_parameters': FieldInfo(annotation=list[str], required=False, default=[], alias='meson-parameters', alias_priority=1), 'plugin': FieldInfo(annotation=Literal['meson'], required=False, default='meson', alias='plugin', alias_priority=1), 'source': FieldInfo(annotation=str, required=True, alias='source', alias_priority=1)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

plugin: Literal['meson']
source: str