craft_parts.utils.path_utils module¶
Utility functions for paths.
- class craft_parts.utils.path_utils.PartitionPathPair(partition: str | None, path: PurePath | str)[source]¶
Bases:
NamedTuple
A pair containing a partition name and a path.
-
partition:
str
|None
¶ Alias for field number 0
-
path:
PurePath
|str
¶ Alias for field number 1
-
partition:
- craft_parts.utils.path_utils.get_partition_and_path(path)[source]¶
Break a partition path into the partition and the child path.
If the path begins with a partition, that is used. Otherwise, the default partition is used. If partitions are not enabled, the partition will be None.
- Parameters:
path (
TypeVar
(FlexiblePath
,PurePath
,str
)) – The filepath to parse.- Return type:
- Returns:
A tuple of (partition, filepath)