From 76c1faf8bfe6a95a30b37cd70001e585e6c1d860 Mon Sep 17 00:00:00 2001 From: Martin Ejdestig Date: Sun, 9 Jul 2017 12:20:05 +0200 Subject: [PATCH 1/2] Modify mesonintrospect --dependencies so 1 element in list is 1 dependency Makes it less awkward for tools to parse the data. Was modified to return a list, with two elements for each dependency, instead of a dictionary in ac1c929f66bde7209f1bd7e2d995dbd3949e1d8b . Closes #2018. --- mesonbuild/mintro.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 5e672bb60..7356175af 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -160,9 +160,9 @@ def list_deps(coredata): result = [] for d in coredata.deps.values(): if d.found(): - args = {'compile_args': d.get_compile_args(), - 'link_args': d.get_link_args()} - result += [d.name, args] + result += [{'name': d.name, + 'compile_args': d.get_compile_args(), + 'link_args': d.get_link_args()}] print(json.dumps(result)) def list_tests(testdata): From 4c8c83c967e79de76c69bf9e524ee6ed8ce6beac Mon Sep 17 00:00:00 2001 From: Martin Ejdestig Date: Sun, 16 Jul 2017 20:08:20 +0200 Subject: [PATCH 2/2] Add a mesonintrospect --dependencies test --- run_unittests.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/run_unittests.py b/run_unittests.py index cc034c32d..664fdefb3 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1828,6 +1828,28 @@ class LinuxlikeTests(BasePlatformTests): return raise RuntimeError('Linker entries not found in the Ninja file.') + def test_introspect_dependencies(self): + ''' + Tests that mesonintrospect --dependencies returns expected output. + ''' + testdir = os.path.join(self.framework_test_dir, '7 gnome') + self.init(testdir) + glib_found = False + gobject_found = False + deps = self.introspect('--dependencies') + self.assertIsInstance(deps, list) + for dep in deps: + self.assertIsInstance(dep, dict) + self.assertIn('name', dep) + self.assertIn('compile_args', dep) + self.assertIn('link_args', dep) + if dep['name'] == 'glib-2.0': + glib_found = True + elif dep['name'] == 'gobject-2.0': + gobject_found = True + self.assertTrue(glib_found) + self.assertTrue(gobject_found) + class LinuxArmCrossCompileTests(BasePlatformTests): ''' Tests that verify cross-compilation to Linux/ARM