]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Use default_factory to evaluate Path.cwd() later
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 23 Aug 2023 10:58:36 +0000 (12:58 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 23 Aug 2023 10:58:36 +0000 (12:58 +0200)
Otherwise, we don't take --directory into account as Path.cwd() is
evaluated on module import.

mkosi/config.py

index 4d3fb60b38fa4367203cddb47a1aaa4f1e26d397..339c45bd591b9351a0fde3d7136e08d5a8b686c3 100644 (file)
@@ -951,7 +951,7 @@ class MkosiConfigParser:
             section="Output",
             parse=config_make_path_parser(required=False),
             paths=("mkosi.output",),
-            default=Path.cwd(),
+            default_factory=lambda _: Path.cwd(),
             help="Output directory",
         ),
         MkosiConfigSetting(
@@ -961,7 +961,7 @@ class MkosiConfigParser:
             section="Output",
             parse=config_make_path_parser(required=False),
             paths=("mkosi.workspace",),
-            default=Path.cwd(),
+            default_factory=lambda _: Path.cwd(),
             help="Workspace directory",
         ),
         MkosiConfigSetting(