From b44a51d0fdd48089d2cc3864d34a3ccad77ec52d Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 7 Jul 2021 17:37:56 +0200 Subject: resolve symlinks passed to -C "meson setup" is resolving symlinks for the build directory in validate_core_dirs. For consistency with it, do the same when the build directory is passed via -C to devenv, dist, init, install and test. This ensures for example that the path to test dependencies is computed correctly in "meson test". Fixes: #8765 --- mesonbuild/mesonlib/universal.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mesonbuild/mesonlib') diff --git a/mesonbuild/mesonlib/universal.py b/mesonbuild/mesonlib/universal.py index 17f604d..65d21ee 100644 --- a/mesonbuild/mesonlib/universal.py +++ b/mesonbuild/mesonlib/universal.py @@ -14,6 +14,7 @@ """A library of random helper functionality.""" from pathlib import Path +import argparse import enum import sys import stat @@ -70,6 +71,7 @@ __all__ = [ 'PerThreeMachine', 'PerThreeMachineDefaultable', 'ProgressBar', + 'RealPathAction', 'TemporaryDirectoryWinProof', 'Version', 'check_direntry_issues', @@ -1843,6 +1845,17 @@ else: ProgressBar = ProgressBarTqdm +class RealPathAction(argparse.Action): + def __init__(self, option_strings: T.List[str], dest: str, default: str = '.', **kwargs: T.Any): + default = os.path.abspath(os.path.realpath(default)) + super().__init__(option_strings, dest, nargs=None, default=default, **kwargs) + + def __call__(self, parser: argparse.ArgumentParser, namespace: argparse.Namespace, + values: T.Union[str, T.Sequence[T.Any], None], option_string: str = None) -> None: + assert isinstance(values, str) + setattr(namespace, self.dest, os.path.abspath(os.path.realpath(values))) + + def get_wine_shortpath(winecmd: T.List[str], wine_paths: T.Sequence[str]) -> str: """Get A short version of @wine_paths to avoid reaching WINEPATH number of char limit. -- cgit v1.1