From cb6f7f9b6f8f1bdb745faee622a8d3c60221db27 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Fri, 25 Apr 2014 22:29:42 +0300 Subject: [PATCH] Can list those files that make up the build system. --- mesonintrospect.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mesonintrospect.py b/mesonintrospect.py index 86d65b103..44a429fba 100755 --- a/mesonintrospect.py +++ b/mesonintrospect.py @@ -29,6 +29,7 @@ import sys, os parser = OptionParser() parser.add_option('--list-targets', action='store_true', dest='list_targets', default=False) parser.add_option('--target-files', action='store', dest='target_files', default=None) +parser.add_option('--buildsystem-files', action='store_true', dest='buildsystem_files', default=False) def list_targets(coredata, builddata): tlist = [] @@ -63,6 +64,16 @@ def list_target_files(target_name, coredata, builddata): sources = [os.path.join(subdir, i) for i in sources] print(json.dumps(sources)) +def list_buildsystem_files(coredata, builddata): + src_dir = builddata.environment.get_source_dir() + # I feel dirty about this. But only slightly. + filelist = [] + for root, dirs, files in os.walk(src_dir): + for f in files: + if f == 'meson.build' or f == 'meson_options.txt': + filelist.append(os.path.relpath(os.path.join(root, f), src_dir)) + print(json.dumps(filelist)) + if __name__ == '__main__': (options, args) = parser.parse_args() if len(args) > 1: @@ -71,7 +82,7 @@ if __name__ == '__main__': elif len(args) == 1: bdir = args[0] else: - bdir == '' + bdir = '' corefile = os.path.join(bdir, 'meson-private/coredata.dat') buildfile = os.path.join(bdir, 'meson-private/build.dat') coredata = pickle.load(open(corefile, 'rb')) @@ -80,6 +91,8 @@ if __name__ == '__main__': list_targets(coredata, builddata) elif options.target_files is not None: list_target_files(options.target_files, coredata, builddata) + elif options.buildsystem_files: + list_buildsystem_files(coredata, builddata) else: print('No command specified') sys.exit(1)