Skip to content

Commit a23ded7

Browse files
committed
boot-qemu.py: Use ternary operators in a couple of places
Clears up ruff warnings: boot-qemu.py:636:9: SIM108 [*] Use ternary operator `qemu = "qemu-system-i386" if arch == "x86" else "qemu-system-x86_64"` instead of if-else-block boot-qemu.py:651:9: SIM108 Use ternary operator `dtb_dir = "dts" if "boot" in str(kernel) else "dtbs"` instead of if-else-block Signed-off-by: Nathan Chancellor <nathan@kernel.org>
1 parent a7a1c4a commit a23ded7

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

boot-qemu.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -633,10 +633,7 @@ def get_qemu_args(cfg):
633633
elif arch == "x86_64":
634634
qemu_args += ["-cpu", "Nehalem"]
635635

636-
if arch == "x86":
637-
qemu = "qemu-system-i386"
638-
else:
639-
qemu = "qemu-system-x86_64"
636+
qemu = "qemu-system-i386" if arch == "x86" else "qemu-system-x86_64"
640637

641638
# Make sure QEMU is available in PATH, otherwise there is little point to
642639
# continuing.
@@ -650,13 +647,10 @@ def get_qemu_args(cfg):
650647

651648
# '-dtb'
652649
if dtb:
653-
# If we are in a boot folder, look for them in the dts folder in it
654-
if "boot" in str(kernel):
655-
dtb_dir = "dts"
650+
# If we are in a boot folder, look for them in the dts folder in it.
656651
# Otherwise, assume there is a dtbs folder in the same folder as the
657652
# kernel image (tuxmake)
658-
else:
659-
dtb_dir = "dtbs"
653+
dtb_dir = "dts" if "boot" in str(kernel) else "dtbs"
660654

661655
dtb = kernel.parent.joinpath(dtb_dir, dtb)
662656
if not dtb.exists():

0 commit comments

Comments
 (0)