From 534a974da756c4b71b7ba10a6853c2be14a9b30e Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Wed, 12 Feb 2020 17:18:53 +0000 Subject: Adjust all the other places MesonException file attribute is set A MesonException has file, lineno and colno attributes, which get formatted as a location in mlog.exception(). The file attribute got changed from a path relative to the root source directory to a pathname (absolute or relative to cwd) in one place in commit b8fbbf59. Adjust all the other places the file attribute is set to match. Also: Setting MesonException.file seems to be missing in the case where Parser returned a non-CodeBlockNode object. Fortunately, that looks like it's unreachable, but add it just in case. --- mesonbuild/optinterpreter.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mesonbuild/optinterpreter.py') diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py index 1a8a04a..2632b31 100644 --- a/mesonbuild/optinterpreter.py +++ b/mesonbuild/optinterpreter.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os, re +import re import functools import typing as T @@ -147,6 +147,7 @@ class OptionInterpreter: if not isinstance(ast, mparser.CodeBlockNode): e = OptionException('Option file is malformed.') e.lineno = ast.lineno() + e.file = option_file raise e for cur in ast.lines: try: @@ -154,7 +155,7 @@ class OptionInterpreter: except Exception as e: e.lineno = cur.lineno e.colno = cur.colno - e.file = os.path.join('meson_options.txt') + e.file = option_file raise e def reduce_single(self, arg): -- cgit v1.1