From f78cf53141a1da1a35fb02324a154f371c488141 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 26 Feb 2017 21:07:09 +0200 Subject: [PATCH] Created merge_from method for ConfigurationData. --- mesonbuild/interpreter.py | 11 +++++++++++ test cases/common/139 simd/meson.build | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 63cdf9ea0..43ddd72a1 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -161,6 +161,7 @@ class ConfigurationDataHolder(MutableInterpreterObject): 'set_quoted': self.set_quoted_method, 'has': self.has_method, 'get': self.get_method, + 'merge_from': self.merge_from_method, }) def is_used(self): @@ -221,6 +222,16 @@ class ConfigurationDataHolder(MutableInterpreterObject): def keys(self): return self.held_object.values.keys() + def merge_from_method(self, args, kwargs): + if len(args) != 1: + raise InterpreterException('Merge_from takes one positional argument.') + from_object = args[0] + if not isinstance(from_object, ConfigurationDataHolder): + raise InterpreterException('Merge_from argument must be a configuration data object.') + from_object = from_object.held_object + for k, v in from_object.values.items(): + self.held_object.values[k] = v + # Interpreter objects can not be pickled so we must have # these wrappers. diff --git a/test cases/common/139 simd/meson.build b/test cases/common/139 simd/meson.build index 2b7d722a6..d84b72248 100644 --- a/test cases/common/139 simd/meson.build +++ b/test cases/common/139 simd/meson.build @@ -4,6 +4,8 @@ simd = import('simd') cc = meson.get_compiler('c') +cdata = configuration_data() + if not meson.is_cross_build() and host_machine.cpu_family() == 'arm' and cc.get_id() == 'clang' message('Adding -march=armv7 because assuming that this build happens on Raspbian.') message('Its Clang seems to be misconfigured and does not support NEON by default.') @@ -29,8 +31,7 @@ rval = simd.check('mysimds', compiler : cc) simdlibs = rval[0] -# FIXME add cdata1.merge_from(cdata2) -cdata = rval[1] +cdata.merge_from(rval[1]) configure_file(output : 'simdconfig.h', configuration : cdata)