aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-12-26 13:24:30 +0200
committerGitHub <noreply@github.com>2017-12-26 13:24:30 +0200
commitac8d6087bfe1a2dacbd13d6cc9c4c526fc997fb5 (patch)
treefb443ccd4bdfa44670cc78a6b14b386cdf625a7a /mesonbuild/interpreter.py
parent1806aac37669fe5b4a50175b7b8298f119248be3 (diff)
parenta5507404ab24c307b1ca5127b59e73759790746a (diff)
downloadmeson-ac8d6087bfe1a2dacbd13d6cc9c4c526fc997fb5.zip
meson-ac8d6087bfe1a2dacbd13d6cc9c4c526fc997fb5.tar.gz
meson-ac8d6087bfe1a2dacbd13d6cc9c4c526fc997fb5.tar.bz2
Merge pull request #2334 from mesonbuild/promotedep
Add functionality to promote nested dependencies to top level.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 7e29b7c..444a6ee 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2224,6 +2224,7 @@ to directly access options of other subprojects.''')
# we won't actually read all the build files.
return fallback_dep
if not dep:
+ self.print_nested_info(name)
assert(exception is not None)
raise exception
@@ -2237,6 +2238,28 @@ to directly access options of other subprojects.''')
def func_disabler(self, node, args, kwargs):
return Disabler()
+ def print_nested_info(self, dependency_name):
+ message_templ = '''\nDependency %s not found but it is available in a sub-subproject.
+To use it in the current project, promote it by going in the project source
+root and issuing %s.
+
+'''
+ sprojs = mesonlib.detect_subprojects('subprojects', self.source_root)
+ if dependency_name not in sprojs:
+ return
+ found = sprojs[dependency_name]
+ if len(found) > 1:
+ suffix = 'one of the following commands'
+ else:
+ suffix = 'the following command'
+ message = message_templ % (dependency_name, suffix)
+ cmds = []
+ command_templ = 'meson wrap promote '
+ for l in found:
+ cmds.append(command_templ + l[len(self.source_root)+1:])
+ final_message = message + '\n'.join(cmds)
+ print(final_message)
+
def get_subproject_infos(self, kwargs):
fbinfo = kwargs['fallback']
check_stringlist(fbinfo)