This commit is contained in:
Marc Beninca 2024-09-13 17:07:27 +02:00
parent 08b6364d9b
commit 3e0d5bf2bc
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -23,7 +23,7 @@ def empty_file(path: str) -> None:
def get_mount_uuid(path: str) -> str: def get_mount_uuid(path: str) -> str:
"""Return the UUID of provided mountpoint path.""" """Return the filesystem UUID of a mountpoint path."""
return ps.run_line( return ps.run_line(
("findmnt",), ("findmnt",),
("--noheadings",), ("--noheadings",),
@ -32,7 +32,8 @@ def get_mount_uuid(path: str) -> str:
) )
def get_path_mount(path: str): def get_path_mount(path: str) -> str:
"""Return the mountpoint path of an arbitrary path."""
return ps.run_line( return ps.run_line(
("stat",), ("stat",),
("--format", "%m"), ("--format", "%m"),
@ -40,11 +41,13 @@ def get_path_mount(path: str):
) )
def get_path_uuid(path: str): def get_path_uuid(path: str) -> str:
"""Return the filesystem UUID of an arbitrary path."""
return get_mount_uuid(get_path_mount(path)) return get_mount_uuid(get_path_mount(path))
def make_directory(path: str): def make_directory(path: str) -> None:
"""Make a directory (and its parents) from a path."""
os.makedirs(path, exist_ok=True) os.makedirs(path, exist_ok=True)