summaryrefslogtreecommitdiff
path: root/math/py-numpy/files/patch-numpy-distutils-system_info.py
blob: 299f983116483a69f34d4d3fb920567d88f3a63a (plain) (blame)
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
60
61
62
63
64
--- 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
     """
     # only these three characters are forbidden in C strings
+    if s is None:
+        return '"None"'
     s = s.replace('\\', r'\\')
     s = s.replace('"',  r'\"')
     s = s.replace('\n', r'\n')
@@ -1112,8 +1114,8 @@ class atlas_info(system_info):
     dir_env_var = 'ATLAS'
     _lib_names = ['f77blas', 'cblas']
     if sys.platform[:7] == 'freebsd':
-        _lib_atlas = ['atlas_r']
-        _lib_lapack = ['alapack_r']
+        _lib_atlas = ['atlas']
+        _lib_lapack = ['alapack']
     else:
         _lib_atlas = ['atlas']
         _lib_lapack = ['lapack']
@@ -1633,11 +1635,6 @@ class blas_opt_info(system_info):
             self.set_info(**blis_info)
             return
 
-        openblas_info = get_info('openblas')
-        if openblas_info:
-            self.set_info(**openblas_info)
-            return
-
         atlas_info = get_info('atlas_3_10_blas_threads')
         if not atlas_info:
             atlas_info = get_info('atlas_3_10_blas')
@@ -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: