craft_parts.executor.filesets module

Definitions and helpers to handle filesets.

class craft_parts.executor.filesets.Fileset(entries, *, name='')[source]

Bases: object

A class that represents a list of filepath strings to include or exclude.

Filepaths to include do not begin with a hyphen. Filepaths to exclude begin with a hyphen.

Parameters:
  • entries (list[str])

  • name (str)

combine(other)[source]

Combine the entries in this fileset with entries from another fileset.

Parameters:

other (Fileset) – The fileset to combine with.

Return type:

None

property entries: list[str]

Return the list of entries in this fileset.

property excludes: list[str]

Return the list of files to be excluded.

property includes: list[str]

Return the list of files to be included.

property name: str

Return the fileset name.

remove(item)[source]

Remove this entry from the list of files.

Parameters:

item (str) – The item to remove.

Return type:

None

craft_parts.executor.filesets.migratable_filesets(fileset, srcdir, partition=None)[source]

Determine the files to migrate from a directory based on a fileset.

Parameters:
  • fileset (Fileset) – The fileset used to filter files in the srcdir.

  • srcdir (str) – Directory containing files to migrate.

  • partition (Optional[str]) – If provided, only get files to migrate to the partition.

Return type:

tuple[set[str], set[str]]

Returns:

A tuple containing the set of files and the set of directories to migrate.