aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r--mesonbuild/mesonlib.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index f3682ce..efb8d11 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -83,6 +83,13 @@ an_unpicklable_object = threading.Lock()
class MesonException(Exception):
'''Exceptions thrown by Meson'''
+ def get_msg_with_context(self):
+ s = ''
+ if hasattr(self, 'lineno') and hasattr(self, 'file'):
+ s = get_error_location_string(self.file, self.lineno) + ' '
+ s += str(self)
+ return s
+
class EnvironmentException(MesonException):
'''Exceptions thrown while processing and creating the build environment'''
@@ -1047,6 +1054,9 @@ def detect_subprojects(spdir_name, current_dir='', result=None):
result[basename] = [trial]
return result
+def get_error_location_string(fname, lineno):
+ return '{}:{}:'.format(fname, lineno)
+
class OrderedSet(collections.MutableSet):
"""A set that preserves the order in which items are added, by first
insertion.