aboutsummaryrefslogtreecommitdiff
path: root/environment.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2013-03-22 22:22:49 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2013-03-22 22:22:49 +0200
commit8ce75af57e7839f1120bee8390cfcd1c6e712be7 (patch)
tree80bac6e7c0645707371f28f20eb90e111605e0ac /environment.py
parentaf82d04b3f8c1d5693723d4fe12e7890108a827b (diff)
downloadmeson-8ce75af57e7839f1120bee8390cfcd1c6e712be7.zip
meson-8ce75af57e7839f1120bee8390cfcd1c6e712be7.tar.gz
meson-8ce75af57e7839f1120bee8390cfcd1c6e712be7.tar.bz2
Rework binary detection and find Valgrind.
Diffstat (limited to 'environment.py')
-rwxr-xr-xenvironment.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/environment.py b/environment.py
index c0b1c03..db44e53 100755
--- a/environment.py
+++ b/environment.py
@@ -206,25 +206,35 @@ class ArLinker():
def get_coverage_link_flags(self):
return []
+def exe_exists(arglist):
+ try:
+ p = subprocess.Popen(arglist, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ p.communicate()
+ if p.returncode == 0:
+ return True
+ except FileNotFoundError:
+ pass
+ return False
+
def find_coverage_tools():
gcovr_exe = 'gcovr'
lcov_exe = 'lcov'
genhtml_exe = 'genhtml'
- pg = subprocess.Popen([gcovr_exe, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- pg.communicate()
- if pg.returncode != 0:
+ if not exe_exists([gcovr_exe, '--version']):
gcovr_exe = None
- pl = subprocess.Popen([lcov_exe, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- pl.communicate()
- if pl.returncode != 0:
+ if not exe_exists([lcov_exe, '--version']):
lcov_exe = None
- ph = subprocess.Popen([genhtml_exe, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- ph.communicate()
- if ph.returncode != 0:
+ if not exe_exists([genhtml_exe, '--version']):
genhtml_exe = None
return (gcovr_exe, lcov_exe, genhtml_exe)
+def find_valgrind():
+ valgrind_exe = 'valgrind'
+ if not exe_exists([valgrind_exe, '--version']):
+ valgrind_exe = None
+ return valgrind_exe
+
def is_osx():
return platform.system().lower() == 'darwin'