mesonlib: Fix bug in relpath return values found by mypy

pull/13001/head
Nirbheek Chauhan 8 months ago committed by Nirbheek Chauhan
parent 069d892237
commit 4b5caa8878
  1. 4
      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

Loading…
Cancel
Save