Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib
diff options
context:
space:
mode:
authorDylan Taylor <dylan@dylanmtaylor.com>2021-05-15 14:10:44 -0400
committerDylan Taylor <dylan@dylanmtaylor.com>2021-05-15 14:29:24 -0400
commita0cbb31d3ef12d5cde2253b4a31757c0409aee40 (patch)
treee907a97d84be56dc9e363b5fa559cc7bcbbebe88 /archinstall/lib
parent85fa833a8afd3bf180720461b7ffd3477f81c049 (diff)
f-string fixes
Diffstat (limited to 'archinstall/lib')
-rw-r--r--archinstall/lib/disk.py14
-rw-r--r--archinstall/lib/general.py2
-rw-r--r--archinstall/lib/hardware.py2
-rw-r--r--archinstall/lib/installer.py22
-rw-r--r--archinstall/lib/mirrors.py2
-rw-r--r--archinstall/lib/user_interaction.py8
6 files changed, 25 insertions, 25 deletions
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index 62f1785f..5967bf3e 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -105,7 +105,7 @@ class BlockDevice():
raise DiskError(f'Can not read partitions off something that isn\'t a block device: {self.path}')
if not o[:1] == b'{':
- raise DiskError(f'Error getting JSON output from:', f'/usr/bin/lsblk -J {self.path}')
+ raise DiskError('Error getting JSON output from:', f'/usr/bin/lsblk -J {self.path}')
r = json.loads(o.decode('UTF-8'))
if len(r['blockdevices']) and 'children' in r['blockdevices'][0]:
@@ -130,7 +130,7 @@ class BlockDevice():
@property
def uuid(self):
- log(f'BlockDevice().uuid is untested!', level=logging.WARNING, fg='yellow')
+ log('BlockDevice().uuid is untested!', level=logging.WARNING, fg='yellow')
"""
Returns the disk UUID as returned by lsblk.
This is more reliable than relying on /dev/disk/by-partuuid as
@@ -441,12 +441,12 @@ class Filesystem():
self.blockdevice.flush_cache()
return self
else:
- raise DiskError(f'Problem setting the partition format to GPT:', f'/usr/bin/parted -s {self.blockdevice.device} mklabel gpt')
+ raise DiskError('Problem setting the partition format to GPT:', f'/usr/bin/parted -s {self.blockdevice.device} mklabel gpt')
elif self.mode == MBR:
if sys_command(f'/usr/bin/parted -s {self.blockdevice.device} mklabel msdos').exit_code == 0:
return self
else:
- raise DiskError(f'Problem setting the partition format to GPT:', f'/usr/bin/parted -s {self.blockdevice.device} mklabel msdos')
+ raise DiskError('Problem setting the partition format to GPT:', f'/usr/bin/parted -s {self.blockdevice.device} mklabel msdos')
else:
raise DiskError(f'Unknown mode selected to format in: {self.mode}')
@@ -465,7 +465,7 @@ class Filesystem():
# TODO: https://stackoverflow.com/questions/28157929/how-to-safely-handle-an-exception-inside-a-context-manager
if len(args) >= 2 and args[1]:
raise args[1]
- b''.join(sys_command(f'sync'))
+ b''.join(sys_command('sync'))
return True
def find_partition(self, mountpoint):
@@ -565,7 +565,7 @@ def all_disks(*args, **kwargs):
kwargs.setdefault("partitions", False)
drives = OrderedDict()
# for drive in json.loads(sys_command(f'losetup --json', *args, **lkwargs, hide_from_log=True)).decode('UTF_8')['loopdevices']:
- for drive in json.loads(b''.join(sys_command(f'lsblk --json -l -n -o path,size,type,mountpoint,label,pkname,model', *args, **kwargs, hide_from_log=True)).decode('UTF_8'))['blockdevices']:
+ for drive in json.loads(b''.join(sys_command('lsblk --json -l -n -o path,size,type,mountpoint,label,pkname,model', *args, **kwargs, hide_from_log=True)).decode('UTF_8'))['blockdevices']:
if not kwargs['partitions'] and drive['type'] == 'part': continue
drives[drive['path']] = BlockDevice(drive['path'], drive)
@@ -639,7 +639,7 @@ def get_filesystem_type(path):
def disk_layouts():
try:
- handle = sys_command(f"lsblk -f -o+TYPE,SIZE -J")
+ handle = sys_command("lsblk -f -o+TYPE,SIZE -J")
return json.loads(b''.join(handle).decode('UTF-8'))
except SysCallError as err:
log(f"Could not return disk layouts: {err}")
diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py
index f9b9078a..b65e2593 100644
--- a/archinstall/lib/general.py
+++ b/archinstall/lib/general.py
@@ -281,7 +281,7 @@ class sys_command:
if 'debug' in self.kwargs and self.kwargs['debug']:
self.log(f"Waiting for last command {self.cmd[0]} to finish.", level=logging.DEBUG)
- if bytes(f']$'.lower(), 'UTF-8') in self.trace_log[0 - len(f']$') - 5:].lower():
+ if bytes(']$'.lower(), 'UTF-8') in self.trace_log[0 - len(']$') - 5:].lower():
if 'debug' in self.kwargs and self.kwargs['debug']:
self.log(f"{self.cmd[0]} has finished.", level=logging.DEBUG)
alive = False
diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py
index 3203daee..d1723cde 100644
--- a/archinstall/lib/hardware.py
+++ b/archinstall/lib/hardware.py
@@ -78,7 +78,7 @@ def hasUEFI() -> bool:
def graphicsDevices() -> dict:
cards = {}
- for line in sys_command(f"lspci"):
+ for line in sys_command("lspci"):
if b' VGA ' in line:
_, identifier = line.split(b': ', 1)
cards[identifier.strip().lower().decode('UTF-8')] = line
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index cacdff69..bac19007 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -70,7 +70,7 @@ class Installer():
return self
def __exit__(self, *args, **kwargs):
- # b''.join(sys_command(f'sync')) # No need to, since the underlying fs() object will call sync.
+ # b''.join(sys_command('sync')) # No need to, since the underlying fs() object will call sync.
# TODO: https://stackoverflow.com/questions/28157929/how-to-safely-handle-an-exception-inside-a-context-manager
if len(args) >= 2 and args[1]:
@@ -82,7 +82,7 @@ class Installer():
# We avoid printing /mnt/<log path> because that might confuse people if they note it down
# and then reboot, and a identical log file will be found in the ISO medium anyway.
print(f"[!] A log file has been created here: {os.path.join(storage['LOG_PATH'], storage['LOG_FILE'])}")
- print(f" Please submit this issue (and file) to https://github.com/archlinux/archinstall/issues")
+ print(" Please submit this issue (and file) to https://github.com/archlinux/archinstall/issues")
raise args[1]
self.genfstab()
@@ -98,7 +98,7 @@ class Installer():
self.log(f' - {step}', fg='red', level=logging.WARNING)
self.log(f"Detailed error logs can be found at: {storage['LOG_PATH']}", level=logging.WARNING)
- self.log(f"Submit this zip file as an issue to https://github.com/archlinux/archinstall/issues", level=logging.WARNING)
+ self.log("Submit this zip file as an issue to https://github.com/archlinux/archinstall/issues", level=logging.WARNING)
self.sync_log_to_install_medium()
return False
@@ -183,7 +183,7 @@ class Installer():
)
def activate_ntp(self):
- self.log(f'Installing and activating NTP.', level=logging.INFO)
+ self.log('Installing and activating NTP.', level=logging.INFO)
if self.pacstrap('ntp'):
if self.enable_service('ntpd'):
return True
@@ -389,7 +389,7 @@ class Installer():
else:
loader_data = [
f"default {self.init_time}",
- f"timeout 5"
+ "timeout 5"
]
with open(f'{self.target}/boot/loader/loader.conf', 'w') as loader:
@@ -407,10 +407,10 @@ class Installer():
# UUID = sys_command('blkid -s PARTUUID -o value {drive}{partition_2}'.format(**args)).decode('UTF-8').strip()
# Setup the loader entry
with open(f'{self.target}/boot/loader/entries/{self.init_time}.conf', 'w') as entry:
- entry.write(f'# Created by: archinstall\n')
+ entry.write('# Created by: archinstall\n')
entry.write(f'# Created on: {self.init_time}\n')
- entry.write(f'title Arch Linux\n')
- entry.write(f'linux /vmlinuz-linux\n')
+ entry.write('title Arch Linux\n')
+ entry.write('linux /vmlinuz-linux\n')
if not isVM():
vendor = cpuVendor()
if vendor == "AuthenticAMD":
@@ -419,7 +419,7 @@ class Installer():
entry.write("initrd /intel-ucode.img\n")
else:
self.log("unknow cpu vendor, not adding ucode to systemd-boot config")
- entry.write(f'initrd /initramfs-linux.img\n')
+ entry.write('initrd /initramfs-linux.img\n')
## blkid doesn't trigger on loopback devices really well,
## so we'll use the old manual method until we get that sorted out.
@@ -506,7 +506,7 @@ class Installer():
if len(language.strip()):
with open(f'{self.target}/etc/vconsole.conf', 'w') as vconsole:
vconsole.write(f'KEYMAP={language}\n')
- vconsole.write(f'FONT=lat9w-16\n')
+ vconsole.write('FONT=lat9w-16\n')
else:
- self.log(f'Keyboard language was not changed from default (no language specified).', fg="yellow", level=logging.INFO)
+ self.log('Keyboard language was not changed from default (no language specified).', fg="yellow", level=logging.INFO)
return True
diff --git a/archinstall/lib/mirrors.py b/archinstall/lib/mirrors.py
index 4b05b96a..e2630710 100644
--- a/archinstall/lib/mirrors.py
+++ b/archinstall/lib/mirrors.py
@@ -77,7 +77,7 @@ def re_rank_mirrors(top=10, *positionals, **kwargs):
def list_mirrors():
- url = f"https://archlinux.org/mirrorlist/?protocol=https&ip_version=4&ip_version=6&use_mirror_status=on"
+ url = "https://archlinux.org/mirrorlist/?protocol=https&ip_version=4&ip_version=6&use_mirror_status=on"
regions = {}
try:
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index 4ca0fed8..69689479 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -125,7 +125,7 @@ def generic_multi_select(options, text="Select one or more of the options above
log(" * If problem persists, please create an issue on https://github.com/archlinux/archinstall/issues * ", fg='yellow')
raise RequirementError("generic_multi_select() requires list or dictionary as options.")
if not options:
- log(f" * Generic multi-select didn't find any options to choose from * ", fg='red')
+ log(" * Generic multi-select didn't find any options to choose from * ", fg='red')
log(" * If problem persists, please create an issue on https://github.com/archlinux/archinstall/issues * ", fg='yellow')
raise RequirementError('generic_multi_select() requires at least one option to proceed.')
# After passing the checks, function continues to work
@@ -491,7 +491,7 @@ def generic_select(options, input_text="Select one of the above by index or abso
log(" * If problem persists, please create an issue on https://github.com/archlinux/archinstall/issues * ", fg='yellow')
raise RequirementError("generic_select() requires list or dictionary as options.")
if not options:
- log(f" * Generic select didn't find any options to choose from * ", fg='red')
+ log(" * Generic select didn't find any options to choose from * ", fg='red')
log(" * If problem persists, please create an issue on https://github.com/archlinux/archinstall/issues * ", fg='yellow')
raise RequirementError('generic_select() requires at least one option to proceed.')
# After passing the checks, function continues to work
@@ -552,7 +552,7 @@ def select_disk(dict_o_disks):
for index, drive in enumerate(drives):
print(f"{index}: {drive} ({dict_o_disks[drive]['size'], dict_o_disks[drive].device, dict_o_disks[drive]['label']})")
- log(f"You can skip selecting a drive and partitioning and use whatever drive-setup is mounted at /mnt (experimental)", fg="yellow")
+ log("You can skip selecting a drive and partitioning and use whatever drive-setup is mounted at /mnt (experimental)", fg="yellow")
drive = generic_select(drives, 'Select one of the above disks (by name or number) or leave blank to use /mnt: ', options_output=False)
if not drive:
return drive
@@ -708,7 +708,7 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS):
default_option = options["All open-source (default)"]
if drivers:
- lspci = sys_command(f'/usr/bin/lspci')
+ lspci = sys_command('/usr/bin/lspci')
for line in lspci.trace_log.split(b'\r\n'):
if b' vga ' in line.lower():
if b'nvidia' in line.lower():