From: Daan De Meyer Date: Thu, 27 Apr 2023 19:03:51 +0000 (+0200) Subject: Fix PathExists X-Git-Tag: v15~188^2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a566cdcc75f7fb4399d8cac6affde2c5730fa479;p=thirdparty%2Fmkosi.git Fix PathExists We now chdir() to the current config directory so we don't have to take the current path into account anymore. --- diff --git a/mkosi/config.py b/mkosi/config.py index 41734b379..ec26dd5ca 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -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")