From 70bf9b03be73295838a040c3bb2e85bfd5d5f6a0 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Mon, 24 Dec 2012 00:21:33 +0200 Subject: [PATCH] Compiler name may have more than one command (i.e. "ccache gcc" works). --- environment.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/environment.py b/environment.py index 5dcd8befb..1127af994 100755 --- a/environment.py +++ b/environment.py @@ -20,26 +20,27 @@ class EnvironmentException(Exception): def __init(self, text): Exception.__init__(self, text) -def detect_c_compiler(exename): - p = subprocess.Popen([exename, '--version'], stdout=subprocess.PIPE) +def detect_c_compiler(execmd): + exelist = execmd.split() + p = subprocess.Popen(exelist + ['--version'], stdout=subprocess.PIPE) (out, err) = p.communicate() out = out.decode() if (out.startswith('cc ') or out.startswith('gcc')) and \ 'Free Software Foundation' in out: - return GnuCCompiler(exename) - raise EnvironmentException('Unknown compiler ' + exename) + return GnuCCompiler(exelist) + raise EnvironmentException('Unknown compiler ' + execmd) class CCompiler(): - def __init__(self, exename): - self.exename = exename + def __init__(self, exelist): + self.exelist = exelist def get_std_warn_flags(self): return [] class GnuCCompiler(CCompiler): std_warn_flags = ['-Wall'] - def __init__(self, exename): - CCompiler.__init__(self, exename) + def __init__(self, exelist): + CCompiler.__init__(self, exelist) def get_std_warn_flags(self): return GnuCCompiler.std_warn_flags