defaults = context.workspace / "repart-definitions"
if not defaults.exists():
defaults.mkdir()
- if (arch := context.config.architecture.to_efi()):
+ if arch := context.config.architecture.to_efi():
bootloader = context.root / f"efi/EFI/BOOT/BOOT{arch.upper()}.EFI"
else:
bootloader = None
remove_build_cache = args.force > 1
remove_package_cache = args.force > 2
- if (outputs := list(config.output_dir_or_cwd().glob(f"{config.output}*"))):
+ if outputs := list(config.output_dir_or_cwd().glob(f"{config.output}*")):
with complete_step(f"Removing output files of {config.name()} image…"):
rmtree(*outputs)
if not v:
die("Match value cannot be empty")
- if (s := SETTINGS_LOOKUP_BY_NAME.get(k)):
+ if s := SETTINGS_LOOKUP_BY_NAME.get(k):
if not s.match:
die(f"{k} cannot be used in [Match]")
else:
result = s.match(v, getattr(namespace, s.dest))
- elif (m := MATCH_LOOKUP.get(k)):
+ elif m := MATCH_LOOKUP.get(k):
result = m.match(v)
else:
die(f"{k} cannot be used in [Match]")
):
die(f"{config.output_format} images cannot be booted with the '{config.qemu_firmware}' firmware")
- if (config.runtime_trees and config.qemu_firmware == QemuFirmware.bios):
+ if config.runtime_trees and config.qemu_firmware == QemuFirmware.bios:
die("RuntimeTrees= cannot be used when booting in BIOS firmware")
if config.qemu_kvm == ConfigFeature.enabled and not config.architecture.is_native():
have_kvm = ((qemu_version(config) < QEMU_KVM_DEVICE_VERSION and QemuDeviceNode.kvm.available()) or
(qemu_version(config) >= QEMU_KVM_DEVICE_VERSION and QemuDeviceNode.kvm in qemu_device_fds))
- if (config.qemu_kvm == ConfigFeature.enabled and not have_kvm):
+ if config.qemu_kvm == ConfigFeature.enabled and not have_kvm:
die("KVM acceleration requested but cannot access /dev/kvm")
if config.qemu_vsock == ConfigFeature.enabled and QemuDeviceNode.vhost_vsock not in qemu_device_fds:
elif "/" in str(name):
name = root / name
- if (binary := shutil.which(name, path=path)):
+ if binary := shutil.which(name, path=path):
if root != Path("/") and not Path(binary).is_relative_to(root):
return Path(binary)
else:
line = line.rstrip()
if not line or line.startswith("#"):
continue
- if (m := re.match(r"([A-Z][A-Z_0-9]+)=(.*)", line)):
+ if m := re.match(r"([A-Z][A-Z_0-9]+)=(.*)", line):
name, val = m.groups()
if val and val[0] in "\"'":
val = ast.literal_eval(val)