From ebb1ad528af0a08caae3f94c3e32d5402ed42633 Mon Sep 17 00:00:00 2001 From: "Michael Hirsch, Ph.D" Date: Thu, 10 Oct 2019 03:54:17 -0400 Subject: 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. --- mesonbuild/interpreter.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mesonbuild/interpreter.py') 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)) -- cgit v1.1