From b28da68faf2485fff018fb59bae2030c379f2376 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 3 Dec 2016 23:45:59 +0200 Subject: Expose project information with mesonintrospect. Closes #1118. --- mesonbuild/mintro.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'mesonbuild/mintro.py') diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index c1af818..f902d3d 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -39,6 +39,8 @@ parser.add_argument('--benchmarks', action='store_true', dest='benchmarks', defa help='List all benchmarks.') parser.add_argument('--dependencies', action='store_true', dest='dependencies', default=False, help='list external dependencies.') +parser.add_argument('--projectinfo', action='store_true', dest='projectinfo', default=False, + help='information about projects.') parser.add_argument('args', nargs='+') def determine_installed_path(target, installdata): @@ -179,6 +181,18 @@ def list_tests(testdata): result.append(to) print(json.dumps(result)) +def list_projinfo(builddata): + result = {} + result['name'] = builddata.project_name + result['version'] = builddata.project_version + subprojects = [] + for k, v in builddata.subprojects.items(): + c = {'name' : k, + 'version' : v} + subprojects.append(c) + result['subprojects'] = subprojects + print(json.dumps(result)) + def run(args): options = parser.parse_args(args) if len(options.args) > 1: @@ -217,6 +231,8 @@ def run(args): list_tests(benchmarkdata) elif options.dependencies: list_deps(coredata) + elif options.projectinfo: + list_projinfo(builddata) else: print('No command specified') return 1 -- cgit v1.1