From f40f1cfd9fce5fe8c713806a83f7c0c0b707816a Mon Sep 17 00:00:00 2001 From: Steve Wills Date: Fri, 31 Jan 2020 14:08:51 +0000 Subject: [PATCH] math/py-numpy: improve patch to fix build with OpenBlas This patch adds openblas to the list of cblas compatible libs instead PR: 243497 Submitted by: John Hein --- .../patch-numpy-distutils-system_info.py | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/math/py-numpy/files/patch-numpy-distutils-system_info.py b/math/py-numpy/files/patch-numpy-distutils-system_info.py index a8dd1d7a9fcd..299f98311648 100644 --- a/math/py-numpy/files/patch-numpy-distutils-system_info.py +++ b/math/py-numpy/files/patch-numpy-distutils-system_info.py @@ -1,4 +1,4 @@ ---- numpy/distutils/system_info.py.orig 2019-08-27 19:01:36 UTC +--- numpy/distutils/system_info.py.orig 2019-08-27 21:01:36 UTC +++ numpy/distutils/system_info.py @@ -172,6 +172,8 @@ def _c_string_literal(s): Convert a python string into a literal suitable for inclusion into C code @@ -32,12 +32,33 @@ atlas_info = get_info('atlas_3_10_blas_threads') if not atlas_info: atlas_info = get_info('atlas_3_10_blas') -@@ -1742,7 +1739,7 @@ class blas_info(system_info): - library_dirs=info['library_dirs'], - extra_postargs=info.get('extra_link_args', [])) - res = "blas" -- except distutils.ccompiler.CompileError: -+ except (distutils.ccompiler.CompileError, distutils.ccompiler.LinkError): +@@ -1730,18 +1727,17 @@ class blas_info(system_info): + # check we can link (find library) + # some systems have separate cblas and blas libs. First + # check for cblas lib, and if not present check for blas lib. +- try: +- c.link_executable(obj, os.path.join(tmpdir, "a.out"), +- libraries=["cblas"], +- library_dirs=info['library_dirs'], +- extra_postargs=info.get('extra_link_args', [])) +- res = "cblas" +- except distutils.ccompiler.LinkError: +- c.link_executable(obj, os.path.join(tmpdir, "a.out"), +- libraries=["blas"], +- library_dirs=info['library_dirs'], +- extra_postargs=info.get('extra_link_args', [])) +- res = "blas" ++ res = None ++ for libname in ['cblas', 'blas', 'openblas']: ++ try: ++ c.link_executable(obj, os.path.join(tmpdir, "a.out"), ++ libraries=[libname], ++ library_dirs=info['library_dirs'], ++ extra_postargs=info.get('extra_link_args', [])) ++ res = libname ++ break ++ except distutils.ccompiler.LinkError: ++ pass + except distutils.ccompiler.CompileError: res = None finally: - shutil.rmtree(tmpdir)