craft_parts.utils.partition_utils module¶
Unit tests for partition utilities.
- craft_parts.utils.partition_utils.get_partition_dir_map(base_dir, partitions, suffix='')¶
Return a mapping of partition directories.
The default partition maps to directories in the base_dir. All other partitions map to directories in partitions/<partition-name>.
If no partitions are provided, return a mapping of None to base_dir/suffix.
- craft_parts.utils.partition_utils.is_default_partition(partitions, partition)¶
Check if given partition is the default one in the given partition list.
- craft_parts.utils.partition_utils.validate_partition_names(partitions)¶
Validate the partition feature set.
- If the partition feature is enabled, then:
each partition name must contain only lowercase alphanumeric characters hyphens and slashes, but not begin or end with a hyphen or a slash
partitions are unique
only the first partition can be named “default”
Namespaced partitions can also be validated in addition to regular (or ‘non-namespaced’) partitions. The format is <namespace>/<partition>.
Namespaced partition names follow the same conventions described above. Namespace names must consist of only lowercase alphanumeric characters.
- Parameters:
partitions (
Sequence[str] |None) – Partition data to verify.- Raises:
ValueError – If the partitions are not valid or the feature is not enabled.
- Return type: