From 8ef4216f01fd470a0fd1a9446b30b993f32dd88c Mon Sep 17 00:00:00 2001 From: Christoph Behle Date: Sat, 9 Jun 2018 19:10:14 +0200 Subject: Concatenate string literals in get_define If get_define returns a list of string_literals concatenate them into one string. --- mesonbuild/compilers/c.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 323e855..1bc4dfd 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import subprocess, os.path +import subprocess, os.path, ast from .. import mlog from .. import coredata @@ -567,8 +567,9 @@ class CCompiler(Compiler): if p.returncode != 0: raise EnvironmentException('Could not get define {!r}'.format(dname)) # Get the preprocessed value after the delimiter, - # minus the extra newline at the end - return p.stdo.split(delim + '\n')[-1][:-1] + # minus the extra newline at the end and + # merge string literals. + return ast.literal_eval(p.stdo.split(delim + '\n')[-1][:-1]) def get_return_value(self, fname, rtype, prefix, env, extra_args, dependencies): if rtype == 'string': -- cgit v1.1