/usr/lib/python3/dist-packages/numpy/linalg/tests/test_build.py is in python3-numpy 1:1.12.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | from __future__ import division, absolute_import, print_function
from subprocess import PIPE, Popen
import sys
import re
from numpy.linalg import lapack_lite
from numpy.testing import TestCase, dec, run_module_suite
from numpy.compat import asbytes_nested
class FindDependenciesLdd(object):
def __init__(self):
self.cmd = ['ldd']
try:
p = Popen(self.cmd, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
except OSError:
raise RuntimeError("command %s cannot be run" % self.cmd)
def get_dependencies(self, lfile):
p = Popen(self.cmd + [lfile], stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
if not (p.returncode == 0):
raise RuntimeError("failed dependencies check for %s" % lfile)
return stdout
def grep_dependencies(self, lfile, deps):
stdout = self.get_dependencies(lfile)
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
class TestF77Mismatch(TestCase):
@dec.skipif(not(sys.platform[:5] == 'linux'),
"Skipping fortran compiler mismatch on non Linux platform")
def test_lapack(self):
f = FindDependenciesLdd()
deps = f.grep_dependencies(lapack_lite.__file__,
asbytes_nested(['libg2c', 'libgfortran']))
self.assertFalse(len(deps) > 1,
"""Both g77 and gfortran runtimes linked in lapack_lite ! This is likely to
cause random crashes and wrong results. See numpy INSTALL.txt for more
information.""")
if __name__ == "__main__":
run_module_suite()
|