craft_parts.sources.snap_source module

The snap source handler.

class craft_parts.sources.snap_source.SnapSource(source, part_src_dir, *, cache_dir, project_dirs, source_tag=None, source_commit=None, source_branch=None, source_depth=None, source_checksum=None, **kwargs)[source]

Bases: FileSourceHandler

Handles downloading and extractions for a snap source.

On provision, the meta directory is renamed to meta.<snap-name> and, if present, the same applies for the snap directory which shall be renamed to snap.<snap-name>.

  • source (str) –

  • part_src_dir (Path) –

  • cache_dir (Path) –

  • project_dirs (ProjectDirs) –

  • source_tag (Optional[str]) –

  • source_commit (Optional[str]) –

  • source_branch (Optional[str]) –

  • source_depth (Optional[int]) –

  • source_checksum (Optional[str]) –

provision(dst, keep=False, src=None)[source]

Provision the snap source.

  • dst (Path) – The destination directory to provision to.

  • keep (bool) – Whether to keep the snap after provisioning is complete.

  • src (Optional[Path]) – Force a new source to use for extraction.

raises errors.InvalidSnap: If trying to provision an invalid snap.

Return type: