diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2014-01-18 23:11:59 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2014-01-18 23:11:59 +0200 |
commit | ab0cc277d19b46f06c5ce9eaaa8d79f9a03445ed (patch) | |
tree | 35a5fe2d3f3073021faccf951a5530056b82d7c5 | |
parent | 4f0af86b52f201d097f0205ba2a024b1c66c6862 (diff) | |
download | meson-ab0cc277d19b46f06c5ce9eaaa8d79f9a03445ed.zip meson-ab0cc277d19b46f06c5ce9eaaa8d79f9a03445ed.tar.gz meson-ab0cc277d19b46f06c5ce9eaaa8d79f9a03445ed.tar.bz2 |
After an actual, factual bug report from a user, fixed include_directories so that it checks that the specified directories exist.
-rw-r--r-- | build.py | 4 | ||||
-rw-r--r-- | interpreter.py | 6 | ||||
-rw-r--r-- | test cases/failing/6 missing incdir/meson.build | 3 |
3 files changed, 10 insertions, 3 deletions
@@ -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.') diff --git a/interpreter.py b/interpreter.py index 402a185..bc5b3ab 100644 --- a/interpreter.py +++ b/interpreter.py @@ -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 diff --git a/test cases/failing/6 missing incdir/meson.build b/test cases/failing/6 missing incdir/meson.build new file mode 100644 index 0000000..617ee77 --- /dev/null +++ b/test cases/failing/6 missing incdir/meson.build @@ -0,0 +1,3 @@ +project('missing incdir', 'c') + +inc = include_directories('nosuchdir') |