Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/linalg/tests/test_build.py @ 87:2a2c65a20a8b
Add Python libs and headers
author | Chris Cannam |
---|---|
date | Wed, 25 Feb 2015 14:05:22 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
86:413a9d26189e | 87:2a2c65a20a8b |
---|---|
1 from __future__ import division, absolute_import, print_function | |
2 | |
3 from subprocess import call, PIPE, Popen | |
4 import sys | |
5 import re | |
6 | |
7 import numpy as np | |
8 from numpy.linalg import lapack_lite | |
9 from numpy.testing import TestCase, dec | |
10 | |
11 from numpy.compat import asbytes_nested | |
12 | |
13 class FindDependenciesLdd(object): | |
14 def __init__(self): | |
15 self.cmd = ['ldd'] | |
16 | |
17 try: | |
18 p = Popen(self.cmd, stdout=PIPE, stderr=PIPE) | |
19 stdout, stderr = p.communicate() | |
20 except OSError: | |
21 raise RuntimeError("command %s cannot be run" % self.cmd) | |
22 | |
23 def get_dependencies(self, lfile): | |
24 p = Popen(self.cmd + [lfile], stdout=PIPE, stderr=PIPE) | |
25 stdout, stderr = p.communicate() | |
26 if not (p.returncode == 0): | |
27 raise RuntimeError("failed dependencies check for %s" % lfile) | |
28 | |
29 return stdout | |
30 | |
31 def grep_dependencies(self, lfile, deps): | |
32 stdout = self.get_dependencies(lfile) | |
33 | |
34 rdeps = dict([(dep, re.compile(dep)) for dep in deps]) | |
35 founds = [] | |
36 for l in stdout.splitlines(): | |
37 for k, v in rdeps.items(): | |
38 if v.search(l): | |
39 founds.append(k) | |
40 | |
41 return founds | |
42 | |
43 class TestF77Mismatch(TestCase): | |
44 @dec.skipif(not(sys.platform[:5] == 'linux'), | |
45 "Skipping fortran compiler mismatch on non Linux platform") | |
46 def test_lapack(self): | |
47 f = FindDependenciesLdd() | |
48 deps = f.grep_dependencies(lapack_lite.__file__, | |
49 asbytes_nested(['libg2c', 'libgfortran'])) | |
50 self.assertFalse(len(deps) > 1, | |
51 """Both g77 and gfortran runtimes linked in lapack_lite ! This is likely to | |
52 cause random crashes and wrong results. See numpy INSTALL.txt for more | |
53 information.""") |