From 2e34024a05ef7d38e24781513d04eab8fb30f882 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Fri, 8 Jun 2018 14:35:29 +0100 Subject: Refine cross file checking to ignore directories e.g. 'meson x86_64-w64-mingw32 --cross-file x86_64-w64-mingw32' currently fails with an IsADirectoryError exception. Cross files must be files, so when searching, only accept a candidate path which is an existing file, not just an existing path. --- mesonbuild/coredata.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mesonbuild') diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 2d44b99..7bedd13 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -236,7 +236,7 @@ class CoreData: if os.path.isabs(filename): return filename path_to_try = os.path.abspath(filename) - if os.path.exists(path_to_try): + if os.path.isfile(path_to_try): return path_to_try if sys.platform != 'win32': paths = [ @@ -244,7 +244,7 @@ class CoreData: ] + os.environ.get('XDG_DATA_DIRS', '/usr/local/share:/usr/share').split(':') for path in paths: path_to_try = os.path.join(path, 'meson', 'cross', filename) - if os.path.exists(path_to_try): + if os.path.isfile(path_to_try): return path_to_try raise MesonException('Cannot find specified cross file: ' + filename) -- cgit v1.1