diff options
-rwxr-xr-x | environment.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/environment.py b/environment.py index 8efdaa2..6169475 100755 --- a/environment.py +++ b/environment.py @@ -319,15 +319,21 @@ class Environment(): def detect_static_linker(self): exelist = self.get_static_linker_exelist() - p = subprocess.Popen(exelist + ['--version'], stdout=subprocess.PIPE) - out = p.communicate()[0] + p = subprocess.Popen(exelist + ['--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (out, err) = p.communicate() out = out.decode() + err = err.decode() if p.returncode == 0: return ArLinker(exelist) + if p.returncode == 1 and err.startswith('usage'): # OSX + return ArLinker(exelist) raise EnvironmentException('Unknown static linker "' + ' '.join(exelist) + '"') def detect_ccache(self): - has_ccache = subprocess.call(['ccache', '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + try: + has_ccache = subprocess.call(['ccache', '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + except FileNotFoundError: + has_ccache = 1 if has_ccache == 0: cmdlist = ['ccache'] else: |