diff options
author | Michael Hirsch, Ph.D <scivision@users.noreply.github.com> | 2019-10-10 03:54:17 -0400 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2019-11-07 17:22:37 +0530 |
commit | 5827d955795b1728b299c5c1f05b9816a3d4abe6 (patch) | |
tree | 576eadca6cf640fb5ab78523ff0b089e985f646c | |
parent | cf7dc02e2de1015db0d1a559b3f486dc80994e15 (diff) | |
download | meson-5827d955795b1728b299c5c1f05b9816a3d4abe6.zip meson-5827d955795b1728b299c5c1f05b9816a3d4abe6.tar.gz meson-5827d955795b1728b299c5c1f05b9816a3d4abe6.tar.bz2 |
path interpreter--silently discard invalid Unix relative paths on Windows
fixes #6000
The idea is that end-users want to specify an array of directories to search by default
without an if/elif stack. It's obvious that Unix absolute paths are not absolute on
Windows, so silently discard Unix absolute paths here for Windows instead of raising
exception.
-rw-r--r-- | mesonbuild/interpreter.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 1d76a1d..d4f02c0 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1557,6 +1557,10 @@ class CompilerHolder(InterpreterObject): search_dirs = mesonlib.stringlistify(kwargs.get('dirs', [])) search_dirs = [Path(d).expanduser() for d in search_dirs] for d in search_dirs: + if mesonlib.is_windows() and d.root.startswith('\\'): + # a Unix-path starting with `/` that is not absolute on Windows. + # discard without failing for end-user ease of cross-platform directory arrays + continue if not d.is_absolute(): raise InvalidCode('Search directory {} is not an absolute path.'.format(d)) search_dirs = list(map(str, search_dirs)) |