From be29dd27b00f3dd6e9523c3c7989046f75a4ece7 Mon Sep 17 00:00:00 2001
From: Ralf Gommers <ralf.gommers@gmail.com>
Date: Wed, 10 Nov 2021 07:48:47 +0100
Subject: [PATCH 4/4] TST: remove fragile test which checks if g77 is linked

We no longer need this test, because g77 is not a thing anymore
(the build will fail or other things will break if an ancient g77
is still used somehow).

This test is also fragile, as seen on conda-forge for the v1.7.2 builds,
the test will fail when the tests run under QEMU with:

E   RuntimeError: Failed to check dependencies for $PREFIX/lib/python3.9/site-packages/scipy/linalg/_flapack.cpython-39-aarch64-linux-gnu.so
        file       = '<...>/lib/python3.9/site-packages/scipy/linalg/_flapack.cpython-39-aarch64-linux-gnu.so'
        p          = <Popen: returncode: 1 args: ['ldd', '/home/conda/feedstock_root/build_artifa...>
        self       = <scipy.linalg.tests.test_build.FindDependenciesLdd object at 0x56782eb100>
        stderr     = b''
        stdout     = b'\tnot a dynamic executable\n'

That seems to be because `ldd` may incorrectly report something is not a
dynamic executable if the correct loader cannot be found.

[ci skip]
---
 scipy/linalg/tests/test_build.py | 55 --------------------------------
 1 file changed, 55 deletions(-)
 delete mode 100644 scipy/linalg/tests/test_build.py

diff --git a/scipy/linalg/tests/test_build.py b/scipy/linalg/tests/test_build.py
deleted file mode 100644
index 96146b68c..000000000
--- a/scipy/linalg/tests/test_build.py
+++ /dev/null
@@ -1,55 +0,0 @@
-from subprocess import call, PIPE, Popen
-import sys
-import re
-
-import pytest
-from numpy.testing import assert_
-
-from scipy.linalg import _flapack as flapack
-
-# XXX: this is copied from numpy trunk. Can be removed when we will depend on
-# numpy 1.3
-
-
-class FindDependenciesLdd:
-    def __init__(self):
-        self.cmd = ['ldd']
-
-        try:
-            call(self.cmd, stdout=PIPE, stderr=PIPE)
-        except OSError as e:
-            raise RuntimeError("command %s cannot be run" % self.cmd) from e
-
-    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" % file)
-
-        return stdout
-
-    def grep_dependencies(self, file, deps):
-        stdout = self.get_dependencies(file)
-
-        rdeps = dict([( dep.encode('latin1'), 
-                        re.compile(dep.encode('latin1'))) 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:
-    @pytest.mark.skipif(not(sys.platform[:5] == 'linux'),
-                        reason="Skipping fortran compiler mismatch on non Linux platform")
-    def test_lapack(self):
-        f = FindDependenciesLdd()
-        deps = f.grep_dependencies(flapack.__file__,
-                                   ['libg2c', 'libgfortran'])
-        assert_(not (len(deps) > 1),
-"""Both g77 and gfortran runtimes linked in scipy.linalg.flapack ! This is
-likely to cause random crashes and wrong results. See numpy INSTALL.rst.txt for
-more information.""")
-- 
2.32.0.windows.2

