aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2018-06-08 14:35:29 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2018-06-09 17:27:07 +0300
commit2e34024a05ef7d38e24781513d04eab8fb30f882 (patch)
tree6da75c5d9950d63b669743c9a6a37a4cbda7de4b
parent6461d4cda2b12ad2d41592d14b72548d1d225b29 (diff)
downloadmeson-2e34024a05ef7d38e24781513d04eab8fb30f882.zip
meson-2e34024a05ef7d38e24781513d04eab8fb30f882.tar.gz
meson-2e34024a05ef7d38e24781513d04eab8fb30f882.tar.bz2
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.
-rw-r--r--mesonbuild/coredata.py4
1 files changed, 2 insertions, 2 deletions
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)