From 2ab05d787534db1cc457a9b1c52f1c3a72f77d9b Mon Sep 17 00:00:00 2001
From: Joseph Weston <joseph.weston08@gmail.com>
Date: Wed, 21 Jun 2017 18:25:04 +0200
Subject: [PATCH] remove configuration of lapack wrapper from setup.py

We use Cython's import mechanism to use the the same lapack used
by Scipy, so we no longer need to explicitly link against lapack
or blas.
---
 setup.py | 42 ++++--------------------------------------
 1 file changed, 4 insertions(+), 38 deletions(-)

diff --git a/setup.py b/setup.py
index 197505db..04d92ea7 100755
--- a/setup.py
+++ b/setup.py
@@ -372,8 +372,9 @@ def search_mumps():
         # Conda (via conda-forge).
         # TODO: remove dependency libs (scotch, metis...) when conda-forge
         # packaged mumps/scotch are built as properly linked shared libs
+        # 'openblas' provides Lapack and BLAS symbols
         ['zmumps', 'mumps_common', 'metis', 'esmumps', 'scotch',
-         'scotcherr', 'mpiseq'],
+         'scotcherr', 'mpiseq', 'openblas'],
     ]
     common_libs = ['pord', 'gfortran']
 
@@ -384,34 +385,7 @@ def search_mumps():
     return []
 
 
-def search_lapack():
-    """Return the BLAS variant that is installed."""
-    lib_sets = [
-        # Debian
-        ['blas', 'lapack'],
-        # Conda (via conda-forge). Openblas contains lapack symbols
-        ['openblas', 'gfortran'],
-    ]
-
-    for libs in lib_sets:
-        found_libs = search_libs(libs)
-        if found_libs:
-            return found_libs
-
-    print('Error: BLAS/LAPACK are required but were not found.',
-          file=sys.stderr)
-    sys.exit(1)
-
-
 def configure_special_extensions(exts, build_summary):
-    #### Special config for LAPACK.
-    lapack = exts['kwant.linalg.lapack']
-    if 'libraries' in lapack:
-        build_summary.append('User-configured LAPACK and BLAS')
-    else:
-        lapack['libraries'] = search_lapack()
-        build_summary.append('Default LAPACK and BLAS')
-
     #### Special config for MUMPS.
     mumps = exts['kwant.linalg._mumps']
     if 'libraries' in mumps:
@@ -426,12 +400,6 @@ def configure_special_extensions(exts, build_summary):
             del exts['kwant.linalg._mumps']
             build_summary.append('No MUMPS support')
 
-    if mumps:
-        # Copy config from LAPACK.
-        for key, value in lapack.items():
-            if key not in ['sources', 'depends']:
-                mumps.setdefault(key, []).extend(value)
-
     return exts
 
 
@@ -550,8 +518,7 @@ def main():
                        'kwant/graph/c_slicer/partitioner.h',
                        'kwant/graph/c_slicer/slicer.h'])),
         ('kwant.linalg.lapack',
-         dict(sources=['kwant/linalg/lapack.pyx'],
-              depends=['kwant/linalg/f_lapack.pxd'])),
+         dict(sources=['kwant/linalg/lapack.pyx'])),
         ('kwant.linalg._mumps',
          dict(sources=['kwant/linalg/_mumps.pyx'],
               depends=['kwant/linalg/cmumps.pxd']))])
@@ -567,8 +534,7 @@ def main():
         for ext in exts.values():
             ext.setdefault('include_dirs', []).append(numpy_include)
 
-    aliases = [('lapack', 'kwant.linalg.lapack'),
-               ('mumps', 'kwant.linalg._mumps')]
+    aliases = [('mumps', 'kwant.linalg._mumps')]
 
     init_cython()
 
-- 
GitLab