From aa7f496144f69fdda4bfaa3cb9f5136c171a15b8 Mon Sep 17 00:00:00 2001 From: Fabio Porcedda Date: Fri, 17 Feb 2017 16:31:43 +0100 Subject: [PATCH 1/3] detect_c_compiler(): use shlex.split() instead of str.split() for env Use shlex.split() for splitting the env var instead of str.split() to handle quoting and spaces in paths. --- mesonbuild/environment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index e143b0b8b..47ab918c5 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -19,6 +19,7 @@ from . import mlog from .compilers import * from .mesonlib import EnvironmentException, Popen_safe import configparser +import shlex import shutil build_filename = 'meson.build' @@ -356,7 +357,7 @@ class Environment: else: exe_wrap = [] elif evar in os.environ: - compilers = os.environ[evar].split() + compilers = shlex.split(os.environ[evar]) ccache = [] is_cross = False exe_wrap = None From 16d4c466fc39d1331e4c9b48d0af7602772faa50 Mon Sep 17 00:00:00 2001 From: Fabio Porcedda Date: Fri, 17 Feb 2017 16:35:03 +0100 Subject: [PATCH 2/3] detect_c_compiler(): support extra commands and arguments in the string - Hanlde correctly a multi command string in evironment variable, e.g.: CC="ccache gcc" meson - Handle correctly a list for the cross-file option, e.g: [binaries] c = ['ccache', '/usr/local/bin/mips-linuc-gcc'] This commit fixes #1392. --- mesonbuild/environment.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 47ab918c5..a7d17501f 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -349,7 +349,9 @@ class Environment: def detect_c_compiler(self, want_cross): evar = 'CC' if self.is_cross_build() and want_cross: - compilers = [self.cross_info.config['binaries']['c']] + compilers = self.cross_info.config['binaries']['c'] + if not isinstance(compilers, list): + compilers = [compilers] ccache = [] is_cross = True if self.cross_info.need_exe_wrapper(): @@ -386,13 +388,13 @@ class Environment: continue gtype = self.get_gnu_compiler_type(defines) version = self.get_gnu_version_from_defines(defines) - return GnuCCompiler(ccache + [compiler], version, gtype, is_cross, exe_wrap, defines) + return GnuCCompiler(ccache + compilers, version, gtype, is_cross, exe_wrap, defines) if 'clang' in out: if 'Apple' in out or for_darwin(want_cross, self): cltype = CLANG_OSX else: cltype = CLANG_STANDARD - return ClangCCompiler(ccache + [compiler], version, cltype, is_cross, exe_wrap) + return ClangCCompiler(ccache + compilers, version, cltype, is_cross, exe_wrap) if 'Microsoft' in out or 'Microsoft' in err: # Visual Studio prints version number to stderr but # everything else to stdout. Why? Lord only knows. @@ -401,7 +403,7 @@ class Environment: if '(ICC)' in out: # TODO: add microsoft add check OSX inteltype = ICC_STANDARD - return IntelCCompiler(ccache + [compiler], version, inteltype, is_cross, exe_wrap) + return IntelCCompiler(ccache + compilers, version, inteltype, is_cross, exe_wrap) errmsg = 'Unknown compiler(s): "' + ', '.join(compilers) + '"' if popen_exceptions: errmsg += '\nThe follow exceptions were encountered:' From 9de7ed82ee67f4235ceb52b4e31a95683a65d5cf Mon Sep 17 00:00:00 2001 From: Fabio Porcedda Date: Tue, 14 Feb 2017 14:09:01 +0100 Subject: [PATCH 3/3] authors: add myself --- authors.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/authors.txt b/authors.txt index 2f36256cc..a5f3d46f8 100644 --- a/authors.txt +++ b/authors.txt @@ -63,3 +63,4 @@ Kseniia Vasilchuk Philipp Geier Mike Sinkovsky Dima Krasner +Fabio Porcedda