]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Fix PathExists
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 27 Apr 2023 19:03:51 +0000 (21:03 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 30 Apr 2023 20:53:55 +0000 (22:53 +0200)
We now chdir() to the current config directory so we don't have to
take the current path into account anymore.

mkosi/config.py

index 41734b3797f6ef45895086bbc8b8a4c112b77130..ec26dd5ca46c79ce1d0b3564e7c607bc73615f9f 100644 (file)
@@ -392,8 +392,11 @@ def config_make_path_parser(*,
     return config_parse_path
 
 
-def match_path_exists(path: Path, value: str) -> bool:
-    return path.parent.joinpath(value).exists()
+def match_path_exists(value: str) -> bool:
+    if not value:
+        return False
+
+    return Path(value).exists()
 
 
 @dataclasses.dataclass(frozen=True)
@@ -415,7 +418,7 @@ class MkosiConfigSetting:
 @dataclasses.dataclass(frozen=True)
 class MkosiMatch:
     name: str
-    match: Callable[[Path, str], bool]
+    match: Callable[[str], bool]
 
 
 class CustomHelpFormatter(argparse.HelpFormatter):
@@ -1081,7 +1084,7 @@ class MkosiConfigParser:
                         return
 
                 elif (m := self.match_lookup.get(k)):
-                    if not m.match(path, v):
+                    if not m.match(v):
                         return
 
         parser.remove_section("Match")