]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Reformat with statements to not use backslashes
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 29 Oct 2023 15:27:52 +0000 (16:27 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 29 Oct 2023 17:35:30 +0000 (18:35 +0100)
Backslashes were required in old python versions, but thankfully they are not
anymore. Even though we used the continuation backslashes, we already had
parenthesis everywhere, so let's just drop the backslashes, and also use a
trailing comma per the usual style.

(https://github.com/python/cpython/issues/56991 says that this happened in
Python 3.10, but it also works with Python 3.9.18 here. I guess the CI will
provide the definite confirmation.)

mkosi/__init__.py
mkosi/qemu.py

index f081d84c4e49aed88feda602dcd560255b290825..6b1d990347470b837c08df5fc4194b861e076e3a 100644 (file)
@@ -451,9 +451,9 @@ def run_build_scripts(state: MkosiState) -> None:
         )
 
     with (
-        mount_build_overlay(state),\
-        mount_volatile_overlay(state),\
-        finalize_chroot_scripts(state) as cd\
+        mount_build_overlay(state),
+        mount_volatile_overlay(state),
+        finalize_chroot_scripts(state) as cd,
     ):
         for script in state.config.build_scripts:
             chroot = chroot_cmd(
@@ -477,8 +477,8 @@ def run_build_scripts(state: MkosiState) -> None:
             cmdline = state.args.cmdline if state.args.verb == Verb.build else []
 
             with (
-                finalize_host_scripts(state, chroot) as hd,\
-                complete_step(f"Running build script {script}…")\
+                finalize_host_scripts(state, chroot) as hd,
+                complete_step(f"Running build script {script}…"),
             ):
                 bwrap(
                     script_maybe_chroot(script, "/work/build-script") + cmdline,
@@ -524,8 +524,8 @@ def run_postinst_scripts(state: MkosiState) -> None:
             )
 
             with (
-                finalize_host_scripts(state, chroot) as hd,\
-                complete_step(f"Running postinstall script {script}…")\
+                finalize_host_scripts(state, chroot) as hd,
+                complete_step(f"Running postinstall script {script}…"),
             ):
                 bwrap(
                     script_maybe_chroot(script, "/work/postinst") + ["final"],
@@ -571,8 +571,8 @@ def run_finalize_scripts(state: MkosiState) -> None:
             )
 
             with (
-                finalize_host_scripts(state, chroot) as hd,\
-                complete_step(f"Running finalize script {script}…")\
+                finalize_host_scripts(state, chroot) as hd,
+                complete_step(f"Running finalize script {script}…"),
             ):
                 bwrap(
                     script_maybe_chroot(script, "/work/finalize"),
@@ -2615,9 +2615,9 @@ def run_verb(args: MkosiArgs, images: Sequence[MkosiConfig]) -> None:
             continue
 
         with (
-            complete_step(f"Building {config.image or 'default'} image"),\
-            mount_tools(config.tools_tree),\
-            prepend_to_environ_path(config)\
+            complete_step(f"Building {config.image or 'default'} image"),
+            mount_tools(config.tools_tree),
+            prepend_to_environ_path(config),
         ):
             # After tools have been mounted, check if we have what we need
             check_tools(args, config)
@@ -2644,9 +2644,9 @@ def run_verb(args: MkosiArgs, images: Sequence[MkosiConfig]) -> None:
         return
 
     with (
-        mount_usr(last.tools_tree),\
-        mount_passwd(),\
-        prepend_to_environ_path(last)\
+        mount_usr(last.tools_tree),
+        mount_passwd(),
+        prepend_to_environ_path(last),
     ):
         check_tools(args, last)
 
index 19ac314cd52f96ed1e15cd3e2a22294c320c36ba..a96cac9307cb8fea6eaba19676169117c0873c16 100644 (file)
@@ -251,8 +251,8 @@ def start_virtiofsd(directory: Path, *, uidmap: bool) -> Iterator[Path]:
     # We create the socket ourselves and pass the fd to virtiofsd to avoid race conditions where we start qemu
     # before virtiofsd has had the chance to create the socket (or where we try to chown it first).
     with (
-        tempfile.TemporaryDirectory(prefix="mkosi-virtiofsd") as state,\
-        socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock\
+        tempfile.TemporaryDirectory(prefix="mkosi-virtiofsd") as state,
+        socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock,
     ):
         # Make sure qemu can access the virtiofsd socket in this directory.
         os.chown(state, INVOKING_USER.uid, INVOKING_USER.gid)