forked from Mirror/pmbootstrap
pmb.qemu.run: Fix odd strings (MR 2513)
Artefact from when we reformatted the entire codebase with Ruff.
This commit is contained in:
parent
b87ae17414
commit
c8194302fc
1 changed files with 6 additions and 8 deletions
|
@ -36,7 +36,7 @@ def system_image(device: str) -> Path:
|
||||||
if not path.exists():
|
if not path.exists():
|
||||||
logging.debug(f"Could not find rootfs: {path}")
|
logging.debug(f"Could not find rootfs: {path}")
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"The rootfs has not been generated yet, please " "run 'pmbootstrap install' first."
|
"The rootfs has not been generated yet, please run 'pmbootstrap install' first."
|
||||||
)
|
)
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ def command_qemu(
|
||||||
command += ["-M", "pseries"]
|
command += ["-M", "pseries"]
|
||||||
command += ["-device", "virtio-gpu-pci"]
|
command += ["-device", "virtio-gpu-pci"]
|
||||||
else:
|
else:
|
||||||
raise RuntimeError(f"Architecture {arch} not supported by this command" " yet.")
|
raise RuntimeError(f"Architecture {arch} not supported by this command yet.")
|
||||||
|
|
||||||
if args.efi:
|
if args.efi:
|
||||||
command += [
|
command += [
|
||||||
|
@ -302,7 +302,7 @@ def resize_image(img_size_new: str, img_path: Path) -> None:
|
||||||
# Make sure we have at least 1 integer followed by either M or G
|
# Make sure we have at least 1 integer followed by either M or G
|
||||||
pattern = re.compile("^[0-9]+[M|G]$")
|
pattern = re.compile("^[0-9]+[M|G]$")
|
||||||
if not pattern.match(img_size_new):
|
if not pattern.match(img_size_new):
|
||||||
raise RuntimeError("IMAGE_SIZE must be in [M]iB or [G]iB, e.g. 2048M" " or 2G")
|
raise RuntimeError("IMAGE_SIZE must be in [M]iB or [G]iB, e.g. 2048M or 2G")
|
||||||
|
|
||||||
# Remove M or G and convert to bytes
|
# Remove M or G and convert to bytes
|
||||||
img_size_new_bytes = int(img_size_new[:-1]) * 1024 * 1024
|
img_size_new_bytes = int(img_size_new[:-1]) * 1024 * 1024
|
||||||
|
@ -329,7 +329,7 @@ def resize_image(img_size_new: str, img_path: Path) -> None:
|
||||||
|
|
||||||
def sigterm_handler(number, frame):
|
def sigterm_handler(number, frame):
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"pmbootstrap was terminated by another process," " and killed the QEMU VM it was running."
|
"pmbootstrap was terminated by another process, and killed the QEMU VM it was running."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -425,7 +425,7 @@ def run(args: PmbArgs) -> None:
|
||||||
"NOTE: Ctrl+C is redirected to the VM! To disable this, "
|
"NOTE: Ctrl+C is redirected to the VM! To disable this, "
|
||||||
"run: pmbootstrap config qemu_redir_stdio False"
|
"run: pmbootstrap config qemu_redir_stdio False"
|
||||||
)
|
)
|
||||||
logging.info("NOTE: To quit QEMU with this option you can use " "Ctrl-A, X.")
|
logging.info("NOTE: To quit QEMU with this option you can use Ctrl-A, X.")
|
||||||
|
|
||||||
if config.ui == "none":
|
if config.ui == "none":
|
||||||
logging.warning(
|
logging.warning(
|
||||||
|
@ -442,9 +442,7 @@ def run(args: PmbArgs) -> None:
|
||||||
# In addition to not showing a trace when pressing ^C, let user know
|
# In addition to not showing a trace when pressing ^C, let user know
|
||||||
# they can override this behavior:
|
# they can override this behavior:
|
||||||
logging.info("Quitting because Ctrl+C detected.")
|
logging.info("Quitting because Ctrl+C detected.")
|
||||||
logging.info(
|
logging.info("To override this behavior and have pmbootstrap send Ctrl+C to the VM, run:")
|
||||||
"To override this behavior and have pmbootstrap " "send Ctrl+C to the VM, run:"
|
|
||||||
)
|
|
||||||
logging.info("$ pmbootstrap config qemu_redir_stdio True")
|
logging.info("$ pmbootstrap config qemu_redir_stdio True")
|
||||||
finally:
|
finally:
|
||||||
if isinstance(process, subprocess.Popen):
|
if isinstance(process, subprocess.Popen):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue