def parse_path(value: str,
*,
required: bool = True,
- absolute: bool = True,
resolve: bool = True,
expanduser: bool = True,
expandvars: bool = True,
if required and not path.exists():
die(f"{value} does not exist")
- if absolute:
- path = path.absolute()
-
if resolve:
path = path.resolve()
src, sep, target = value.partition(':')
src_path = parse_path(src, required=False)
if sep:
- target_path = parse_path(target, required=False, absolute=False, resolve=False, expanduser=False)
+ target_path = parse_path(target, required=False, resolve=False, expanduser=False)
if absolute and not target_path.is_absolute():
die("Target path must be absolute")
else:
def make_path_parser(*,
required: bool = True,
- absolute: bool = True,
+ resolve: bool = True,
expanduser: bool = True,
expandvars: bool = True,
secret: bool = False) -> Callable[[str], Path]:
return functools.partial(
parse_path,
required=required,
- absolute=absolute,
+ resolve=resolve,
expanduser=expanduser,
expandvars=expandvars,
secret=secret,
def config_make_path_parser(*,
required: bool = True,
- absolute: bool = True,
resolve: bool = True,
expanduser: bool = True,
expandvars: bool = True,
return parse_path(
value,
required=required,
- absolute=absolute,
resolve=resolve,
expanduser=expanduser,
expandvars=expandvars,
dest="tools_tree",
metavar="PATH",
section="Host",
- parse=config_make_path_parser(required=False, absolute=False),
+ parse=config_make_path_parser(required=False, resolve=False),
paths=("mkosi.tools",),
help="Look up programs to execute inside the given tree",
),
f,
secret=s.path_secret,
required=False,
- absolute=False,
resolve=False,
expanduser=False,
expandvars=False,