diff options
| author | Nirbheek Chauhan <nirbheek@centricular.com> | 2024-03-20 02:47:03 +0530 |
|---|---|---|
| committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2024-03-20 04:16:28 +0530 |
| commit | 4b5caa887851613878be29410decb45477f0a3bc (patch) | |
| tree | 7ac736fbef5728118350878bb9ceea97cb0633fe /mesonbuild/utils | |
| parent | 069d89223769a380ccecd069a01e3bd5d71fdef3 (diff) | |
| download | meson-4b5caa887851613878be29410decb45477f0a3bc.tar.gz | |
mesonlib: Fix bug in relpath return values found by mypy
Diffstat (limited to 'mesonbuild/utils')
| -rw-r--r-- | mesonbuild/utils/universal.py | 4 |
1 files changed, 2 insertions, 2 deletions
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 |
