SnapcraftBuilder

The SnapcraftBuilder type coordinates the invocation of the snapcraft command.

Constructors

SnapcraftBuilder()

SnapcraftBuilder() constructs a new instance from a Snap.

It accepts the following arguments:

snap

(Snap) The Snap defining the configuration to be used.

Methods

SnapcraftBuilder.add_invocation()

This method registers an invocation of snapcraft with the builder. When this instance is built, all registered invocations will be run sequentially.

The following arguments are accepted:

args

(List[String]) Arguments to pass to snapcraft executable.

purge_build

(Optional[bool]) Whether to purge the build directory before running this invocation.

If not specified, the build directory is purged for the first registered invocation and not purged for all subsequent invocations.

SnapcraftBuilder.add_file_manifest()

This method registers the content of a FileManifest with the build environment for this builder.

When this instance is built, the content of the passed manifest will be materialized in a directory next to the snapcraft.yaml file this instance is building.

The following arguments are accepted:

manifest

(FileManifest) A FileManifest defining files to install in the build environment.

SnapcraftBuilder.build()

This method invokes the builder and runs snapcraft.

The following arguments are accepted:

target

(String) The name of the build target.

This method returns a ResolvedTarget. That target is not runnable.