diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2013-08-10 23:17:11 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2013-08-10 23:17:11 +0300 |
commit | 619b37bff916862527e2ee524a088cd15ce893f1 (patch) | |
tree | 30fbc6e1ad6a67d20c51e36c105dc8afb1ccacad /interpreter.py | |
parent | d02e4ce1c972ddae681c63310ca399b32811c4a2 (diff) | |
download | meson-619b37bff916862527e2ee524a088cd15ce893f1.zip meson-619b37bff916862527e2ee524a088cd15ce893f1.tar.gz meson-619b37bff916862527e2ee524a088cd15ce893f1.tar.bz2 |
Check that non-existing source files cause errors.
Diffstat (limited to 'interpreter.py')
-rw-r--r-- | interpreter.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/interpreter.py b/interpreter.py index 5095640..2e1cced 100644 --- a/interpreter.py +++ b/interpreter.py @@ -1178,11 +1178,20 @@ class Interpreter(): sources += kw_src if name in self.build.targets: raise InvalidCode('Tried to create target "%s", but a target of that name already exists.' % name) + self.check_sources_exist(os.path.join(self.environment.source_dir, self.subdir), sources) l = targetclass(name, self.subdir, sources, self.environment, kwargs) self.build.targets[name] = l mlog.log('Creating build target "', mlog.bold(name), '" with %d files.' % len(sources), sep='') return l + def check_sources_exist(self, subdir, sources): + for s in sources: + if not isinstance(s, str): + continue # This means a generated source and they always exist. + fname = os.path.join(subdir, s) + if not os.path.isfile(fname): + raise InterpreterException('Tried to add non-existing source %s.' % s) + def function_call(self, node): func_name = node.get_function_name() (posargs, kwargs) = self.reduce_arguments(node.arguments) |