craft_parts.sources.local_source module¶
The local source handler and helpers.
- class craft_parts.sources.local_source.LocalSource(*args, project_dirs, copy_function=<function link_or_copy>, **kwargs)[source]¶
Bases:
SourceHandler
The local source handler.
- Parameters:
args (
Any
)project_dirs (
ProjectDirs
)copy_function (
Callable
[...
,None
])kwargs (
Any
)
- check_if_outdated(target, *, ignore_files=None)[source]¶
Check if pulled sources have changed since target was created.
- Parameters:
target (
str
) – Path to target file.ignore_files (
Optional
[list
[str
]]) – Files excluded from verification.
- Return type:
bool
- Returns:
Whether the sources are outdated.
- get_outdated_files()[source]¶
Obtain lists of outdated files and directories.
- Return type:
tuple
[list
[str
],list
[str
]]- Returns:
The lists of outdated files and directories.
- Raises:
errors.SourceUpdateUnsupported – If the source handler can’t check if files are outdated.
- source_model¶
alias of
LocalSourceModel
- update()[source]¶
Update pulled source.
Call method
check_if_outdated()
before updating to populate the lists of files and directories to copy.- Return type:
None
- class craft_parts.sources.local_source.LocalSourceModel(**data)[source]¶
Bases:
BaseSourceModel
Pydantic model for a generic local source.
- Parameters:
data (
Any
)
- model_config: ClassVar[ConfigDict] = {'alias_generator': <function get_model_config.<locals>.<lambda>>, 'extra': 'forbid', 'frozen': True, 'json_schema_extra': {'if': {'not': {'required': ['source-type']}}, 'then': {'properties': {'source': {'pattern': '^\\./?'}}}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
source:
Annotated
[Path
]¶
-
source_type:
Literal
['local'
]¶ The name of this source type.
Sources must define this with a type hint of a Literal type of its name and a value of its name.