From 319ff38951b9ffc1f8fe366bcbc087cd7ffcd96a Mon Sep 17 00:00:00 2001 From: David Cournapeau Date: Sat, 8 Nov 2008 06:51:42 +0000 Subject: Start working on test to detect fortran compiler mismatch. --- numpy/linalg/tests/test_build.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 numpy/linalg/tests/test_build.py (limited to 'numpy/linalg/tests') diff --git a/numpy/linalg/tests/test_build.py b/numpy/linalg/tests/test_build.py new file mode 100644 index 000000000..ccba19bb1 --- /dev/null +++ b/numpy/linalg/tests/test_build.py @@ -0,0 +1,35 @@ +from subprocess import call, PIPE, Popen +import sys +import re + +import numpy as np +from numpy.testing import TestCase + +class FindDependenciesLdd: + def __init__(self): + self.cmd = ['ldd'] + + try: + st = call(self.cmd, stdout=PIPE, stderr=PIPE) + except OSError: + raise RuntimeError("command %s cannot be run" % self.cmd) + + def get_dependencies(self, file): + p = Popen(self.cmd + [file], stdout=PIPE, stderr=PIPE) + stdout, stderr = p.communicate() + if not (p.returncode == 0): + raise RuntimeError("Failed to check dependencies for %s" % libfile) + + return stdout + + def grep_dependencies(self, file, deps): + stdout = self.get_dependencies(file) + + rdeps = dict([(dep, re.compile(dep)) for dep in deps]) + founds = [] + for l in stdout.splitlines(): + for k, v in rdeps.items(): + if v.search(l): + founds.append(k) + + return founds -- cgit v1.2.1