aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorMichael Hirsch, Ph.D <scivision@users.noreply.github.com>2019-10-10 03:54:17 -0400
committerDylan Baker <dylan@pnwbakers.com>2019-10-11 10:08:00 -0700
commitebb1ad528af0a08caae3f94c3e32d5402ed42633 (patch)
tree4ff43b55f89ed92ba420299066b13322c22496b1 /mesonbuild/interpreter.py
parent9f0f595b351aba8edce1d27e79c3be2a50f9a1f4 (diff)
downloadmeson-ebb1ad528af0a08caae3f94c3e32d5402ed42633.zip
meson-ebb1ad528af0a08caae3f94c3e32d5402ed42633.tar.gz
meson-ebb1ad528af0a08caae3f94c3e32d5402ed42633.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.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py4
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))