After an actual, factual bug report from a user, fixed include_directories so that it checks that the specified directories exist.

pull/15/head
Jussi Pakkanen 11 years ago
parent 4f0af86b52
commit ab0cc277d1
  1. 4
      build.py
  2. 6
      interpreter.py
  3. 3
      test cases/failing/6 missing incdir/meson.build

@ -86,8 +86,8 @@ class IncludeDirs():
def __init__(self, curdir, dirs, kwargs):
self.curdir = curdir
self.incdirs = dirs
# Fixme: check that the directories actually exist.
# Also that they don't contain ".." or somesuch.
# Interpreter has validated that all given directories
# actually exist.
if len(kwargs) > 0:
raise InvalidArguments('Includedirs function does not take keyword arguments.')

@ -1001,10 +1001,14 @@ class Interpreter():
conf.mark_used()
def func_include_directories(self, node, args, kwargs):
curdir = os.path.join(self.subproject, self.subdir)
absbase = os.path.join(self.environment.get_source_dir(), curdir)
for a in args:
if not isinstance(a, str):
raise InvalidArguments('Argument %s is not a string.' % str(a))
curdir = os.path.join(self.subproject, self.subdir)
absdir = os.path.join(absbase, a)
if not os.path.isdir(absdir):
raise InvalidArguments('Include dir %s does not exist.' % a)
i = IncludeDirsHolder(curdir, args, kwargs)
return i

@ -0,0 +1,3 @@
project('missing incdir', 'c')
inc = include_directories('nosuchdir')
Loading…
Cancel
Save