diff --git a/mesonbuild/utils/universal.py b/mesonbuild/utils/universal.py index a5383455a..edb309f0d 100644 --- a/mesonbuild/utils/universal.py +++ b/mesonbuild/utils/universal.py @@ -1930,14 +1930,14 @@ class OrderedSet(T.MutableSet[_T]): for item in iterable: self.discard(item) -def relpath(path: str, start: str) -> str: +def relpath(path: T.Union[str, Path], start: T.Union[str, Path]) -> str: # On Windows a relative path can't be evaluated for paths on two different # drives (i.e. c:\foo and f:\bar). The only thing left to do is to use the # original absolute path. try: return os.path.relpath(path, start) except (TypeError, ValueError): - return path + return str(path) def path_is_in_root(path: Path, root: Path, resolve: bool = False) -> bool: # Check whether a path is within the root directory root