aboutsummaryrefslogtreecommitdiff
path: root/environment.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2012-12-24 00:21:33 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2012-12-24 00:21:33 +0200
commit70bf9b03be73295838a040c3bb2e85bfd5d5f6a0 (patch)
treee31ac0272b5f985cdd87f3d8d9cdd3a9875df7f3 /environment.py
parentc3c9a31a5a51ea2b2c7b560262a5af0d372d52ab (diff)
downloadmeson-70bf9b03be73295838a040c3bb2e85bfd5d5f6a0.zip
meson-70bf9b03be73295838a040c3bb2e85bfd5d5f6a0.tar.gz
meson-70bf9b03be73295838a040c3bb2e85bfd5d5f6a0.tar.bz2
Compiler name may have more than one command (i.e. "ccache gcc" works).
Diffstat (limited to 'environment.py')
-rwxr-xr-xenvironment.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/environment.py b/environment.py
index 5dcd8be..1127af9 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