This commit is contained in:
Marc Beninca 2024-06-10 09:51:59 +02:00
parent c7db231dc2
commit 592023d214
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -3,13 +3,13 @@ import shutil
from rwx import ps
CHARSET = 'UTF-8'
CHARSET = "UTF-8"
def create_image(file_path: str, size_bytes: int):
ps.run(
('qemu-img', 'create'),
('-f', 'qcow2'),
("qemu-img", "create"),
("-f", "qcow2"),
(file_path, size_bytes),
)
@ -20,17 +20,17 @@ def empty_file(path: str):
def get_mount_uuid(path: str):
return ps.run_line(
('findmnt',),
('--noheadings',),
('--output', 'UUID'),
("findmnt",),
("--noheadings",),
("--output", "UUID"),
(path,),
)
def get_path_mount(path: str):
return ps.run_line(
('stat',),
('--format', '%m'),
("stat",),
("--format", "%m"),
(path,),
)
@ -44,7 +44,7 @@ def make_directory(path: str):
def read_file(file_path: str):
with open(file_path, 'br') as file_object:
with open(file_path, "br") as file_object:
return file_object.read()
@ -66,5 +66,5 @@ def wipe(path: str):
def write(file_path: str, text: str, charset=CHARSET):
with open(file_path, 'bw') as file_object:
with open(file_path, "bw") as file_object:
file_object.write(text.encode(charset))