diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2017-08-14 15:54:07 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-08-14 18:44:39 +0300 |
commit | c69a4aee1eb8f78770d59afec6dd12ebea9bfbd1 (patch) | |
tree | 8a675683ba5a7d19f4530e963b64002fbb1b70c6 | |
parent | 5c8328d27f5a830b604dc8635815eee916a51971 (diff) | |
download | meson-c69a4aee1eb8f78770d59afec6dd12ebea9bfbd1.zip meson-c69a4aee1eb8f78770d59afec6dd12ebea9bfbd1.tar.gz meson-c69a4aee1eb8f78770d59afec6dd12ebea9bfbd1.tar.bz2 |
Store current line number so it can be printed in warning messages. Closes #2181.
-rw-r--r-- | mesonbuild/interpreterbase.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mesonbuild/interpreterbase.py b/mesonbuild/interpreterbase.py index 213b2bb..c075541 100644 --- a/mesonbuild/interpreterbase.py +++ b/mesonbuild/interpreterbase.py @@ -65,7 +65,9 @@ class permittedKwargs: def wrapped(s, node, args, kwargs): for k in kwargs: if k not in self.permitted: - mlog.warning('Passed invalid keyword argument "%s". This will become a hard error in the future.' % k) + fname = os.path.join(s.subdir, environment.build_filename) + mlog.warning('''Passed invalid keyword argument "%s" in %s line %d. +This will become a hard error in the future.''' % (k, fname, s.current_lineno)) return f(s, node, args, kwargs) return wrapped @@ -101,6 +103,7 @@ class InterpreterBase: self.subdir = subdir self.variables = {} self.argument_depth = 0 + self.current_lineno = -1 def load_root_meson_file(self): mesonfile = os.path.join(self.source_root, self.subdir, environment.build_filename) @@ -151,6 +154,7 @@ class InterpreterBase: while i < len(statements): cur = statements[i] try: + self.current_lineno = cur.lineno self.evaluate_statement(cur) except Exception as e: if not(hasattr(e, 'lineno')): |