Skip to content

Commit

Permalink
Use f-strings and os.linesep
Browse files Browse the repository at this point in the history
  • Loading branch information
KaliumPuceon committed Nov 2, 2023
1 parent 8f76d38 commit 8a23af6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions kiwi/bootloader/config/grub2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1464,19 +1464,19 @@ def _fix_grub_loader_entries_linux_and_initrd_paths(self):
for line_number, menu_entry_line in enumerate(menu_entry):
if bool(re.match(r'^(linux|initrd) .*', menu_entry_line)):

log.debug("Existing loader entry: %s", menu_entry_line)
log.debug(f'Existing loader entry: {menu_entry_line}')
config_path = menu_entry_line.split(" ", 1)[0]

basename = os.path.basename(menu_entry_line)
if self.bootpartition:
config_path += (" /%s" % basename)
config_path = (f'{config_path} /{basename}')
else:
config_path += (" /boot/%s" % basename)
config_path = (f'{config_path} /boot/{basename}')

menu_entry[line_number] = config_path
log.debug("Updated loader entry: %s", config_path)
log.debug(f'Updated loader entry: {config_path}')

menu_entry = "\n".join(menu_entry)
menu_entry = os.linesep.join(menu_entry)
with open(menu_entry_file, 'w') as grub_menu_entry_file:
grub_menu_entry_file.write(menu_entry)

Expand Down

0 comments on commit 8a23af6

Please sign in to comment.