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 calledscons-deps
and have the part that uses this plugin depend on thescons-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 thescons
andscons install
command lines.
- Parameters:
properties (
PluginProperties
)part_info (
PartInfo
)
- 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_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]] = {'plugin': FieldInfo(annotation=Literal['scons'], required=False, default='scons', alias='plugin', alias_priority=1), 'scons_parameters': FieldInfo(annotation=list[str], required=False, default=[], alias='scons-parameters', 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
['scons'
]¶
-
scons_parameters:
list
[str
]¶
-
source:
str
¶