[initcpiocfg] Use F strings, python3.6 only

This commit is contained in:
Vitor Lopes 2020-12-09 13:32:39 +00:00 committed by Adriaan de Groot
parent 1fe27effe5
commit 4b08aebe7f

View File

@ -72,7 +72,7 @@ def write_mkinitcpio_lines(hooks, modules, files, root_mount_point):
with open(hostfile, "r") as mkinitcpio_file: with open(hostfile, "r") as mkinitcpio_file:
mklins = [x.strip() for x in mkinitcpio_file.readlines()] mklins = [x.strip() for x in mkinitcpio_file.readlines()]
except FileNotFoundError: except FileNotFoundError:
libcalamares.utils.debug("Could not open host file {!s}".format(hostfile)) libcalamares.utils.debug(f"Could not open host file {hostfile}")
mklins = [] mklins = []
for i in range(len(mklins)): for i in range(len(mklins)):
@ -170,7 +170,7 @@ def modify_mkinitcpio_conf(partitions, root_mount_point):
os.path.isfile( os.path.isfile(
os.path.join(root_mount_point, crypto_file) os.path.join(root_mount_point, crypto_file)
): ):
files.append("/{!s}".format(crypto_file)) files.append(f"/{crypto_file}")
if lvm2: if lvm2:
hooks.append("lvm2") hooks.append("lvm2")
@ -202,13 +202,13 @@ def run():
root_mount_point = libcalamares.globalstorage.value("rootMountPoint") root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
if not partitions: if not partitions:
libcalamares.utils.warning("partitions is empty, {!s}".format(partitions)) libcalamares.utils.warning(f"partitions is empty, {partitions}")
return (_("Configuration Error"), return (_("Configuration Error"),
_("No partitions are defined for <pre>{!s}</pre> to use.").format("initcpiocfg")) _("No partitions are defined for <pre>initcpiocfg</pre> to use."))
if not root_mount_point: if not root_mount_point:
libcalamares.utils.warning("rootMountPoint is empty, {!s}".format(root_mount_point)) libcalamares.utils.warning(f"rootMountPoint is empty, {root_mount_point}")
return (_("Configuration Error"), return (_("Configuration Error"),
_("No root mount point is given for <pre>{!s}</pre> to use.").format("initcpiocfg")) _("No root mount point is given for <pre>initcpiocfg</pre> to use."))
modify_mkinitcpio_conf(partitions, root_mount_point) modify_mkinitcpio_conf(partitions, root_mount_point)