[Numpy-svn] r5987 - trunk/numpy/linalg/tests

numpy-svn@scip... numpy-svn@scip...
Sat Nov 8 00:51:49 CST 2008


Author: cdavid
Date: 2008-11-08 00:51:42 -0600 (Sat, 08 Nov 2008)
New Revision: 5987

Added:
   trunk/numpy/linalg/tests/test_build.py
Log:
Start working on test to detect fortran compiler mismatch.

Added: trunk/numpy/linalg/tests/test_build.py
===================================================================
--- trunk/numpy/linalg/tests/test_build.py	2008-11-07 08:14:06 UTC (rev 5986)
+++ trunk/numpy/linalg/tests/test_build.py	2008-11-08 06:51:42 UTC (rev 5987)
@@ -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



More information about the Numpy-svn mailing list