craft_parts.plugins.scons_plugin module

The SCons plugin.

class craft_parts.plugins.scons_plugin.SConsPlugin(*, properties, part_info)[source]

Bases: Plugin

A plugin for SCons projects.

The plugin needs the scons tool which can be provisioned in one of the following ways:

  • Add “scons” to the part’s build-packages;

  • Build a custom version of scons on a separate part called scons-deps and have the part that uses this plugin depend on the scons-deps part.

Note that other dependencies (C/C++ compiler, Java compiler, etc) must be declared via build-packages or otherwise provisioned.

Since there is no “official” way of defining the target installation directory for SCons-built artifacts, the default build will set the DESTDIR environment variable which contains the root which the SConstruct file should use to configure its Install() builder target.

The plugin supports the following keywords:

  • scons-parameters (list of strings) Additional values to pass to the scons and scons install command lines.

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]

properties_class

alias of SConsPluginProperties

validator_class

alias of SConsPluginEnvironmentValidator

class craft_parts.plugins.scons_plugin.SConsPluginEnvironmentValidator(*, part_name, env, properties)[source]

Bases: PluginEnvironmentValidator

Check the execution environment for the SCons 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 scons is invalid and there are no parts named “scons-deps”.

Return type:

None

class craft_parts.plugins.scons_plugin.SConsPluginProperties(**data)[source]

Bases: PluginProperties

The part properties used by the SCons plugin.

Parameters:

data (Any)

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].

plugin: Literal['scons']
scons_parameters: list[str]
source: str