aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/interpreter/interpreter.py14
-rw-r--r--mesonbuild/interpreter/interpreterobjects.py4
2 files changed, 12 insertions, 6 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index 2da966c..7a3ffb1 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -999,7 +999,8 @@ class Interpreter(InterpreterBase, HoldableObject):
raise InterpreterException(f'Subproject {subp_name} version is {pv} but {wanted} required.')
self.active_projectname = current_active
self.subprojects.update(subi.subprojects)
- self.subprojects[subp_name] = SubprojectHolder(subi, subdir, warnings=subi_warnings)
+ self.subprojects[subp_name] = SubprojectHolder(subi, subdir, warnings=subi_warnings,
+ callstack=self.subproject_stack)
# Duplicates are possible when subproject uses files from project root
if build_def_files:
self.build_def_files.update(build_def_files)
@@ -1370,13 +1371,16 @@ class Interpreter(InterpreterBase, HoldableObject):
# Add automatic 'Subprojects' section in main project.
all_subprojects = collections.OrderedDict()
for name, subp in sorted(self.subprojects.items()):
- value = subp.found()
+ value = [subp.found()]
if subp.disabled_feature:
- value = [value, f'Feature {subp.disabled_feature!r} disabled']
+ value += [f'Feature {subp.disabled_feature!r} disabled']
elif subp.exception:
- value = [value, str(subp.exception)]
+ value += [str(subp.exception)]
elif subp.warnings > 0:
- value = [value, f'{subp.warnings} warnings']
+ value += [f'{subp.warnings} warnings']
+ if subp.callstack:
+ stack = ' => '.join(subp.callstack)
+ value += [f'(from {stack})']
all_subprojects[name] = value
if all_subprojects:
self.summary_impl('Subprojects', all_subprojects,
diff --git a/mesonbuild/interpreter/interpreterobjects.py b/mesonbuild/interpreter/interpreterobjects.py
index fa91714..c1ce0da 100644
--- a/mesonbuild/interpreter/interpreterobjects.py
+++ b/mesonbuild/interpreter/interpreterobjects.py
@@ -731,7 +731,8 @@ class SubprojectHolder(MesonInterpreterObject):
subdir: str,
warnings: int = 0,
disabled_feature: T.Optional[str] = None,
- exception: T.Optional[Exception] = None) -> None:
+ exception: T.Optional[Exception] = None,
+ callstack: T.Optional[T.List[str]] = None) -> None:
super().__init__()
self.held_object = subinterpreter
self.warnings = warnings
@@ -739,6 +740,7 @@ class SubprojectHolder(MesonInterpreterObject):
self.exception = exception
self.subdir = PurePath(subdir).as_posix()
self.cm_interpreter: T.Optional[CMakeInterpreter] = None
+ self.callstack = callstack
self.methods.update({'get_variable': self.get_variable_method,
'found': self.found_method,
})