Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 9c8641a

Browse files
committed
Replace other usages of cblas name
1 parent 273bb93 commit 9c8641a

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

src/sage/env.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,13 @@ def sage_include_directories(use_sources=False):
370370
distutils.sysconfig.get_python_inc(),
371371
numpy.get_include()]
372372

373+
def get_cblas_pc_module_name() -> str:
374+
"""
375+
Return the name of the BLAS libraries to be used.
376+
"""
377+
import pkgconfig
378+
cblas_pc_modules = CBLAS_PC_MODULES.split(':')
379+
return next((blas_lib for blas_lib in cblas_pc_modules if pkgconfig.exists(blas_lib)))
373380

374381
def cython_aliases():
375382
"""
@@ -395,9 +402,7 @@ def cython_aliases():
395402
'libpng', 'gdlib', 'm4ri', 'zlib', 'cblas', 'lapack']:
396403
var = lib.upper().replace("-", "") + "_"
397404
if lib == 'cblas':
398-
# There are a few BLAS libraries that the user could have installed
399-
cblas_pc_modules = CBLAS_PC_MODULES.split(':')
400-
lib = next((blas_lib for blas_lib in cblas_pc_modules if pkgconfig.exists(blas_lib)))
405+
lib = get_cblas_pc_module_name()
401406
if lib == 'zlib':
402407
aliases[var + "CFLAGS"] = ""
403408
try:

src/sage/misc/cython.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,14 @@
2626
import pkgconfig
2727

2828
from sage.env import (SAGE_LOCAL, cython_aliases,
29-
sage_include_directories)
29+
sage_include_directories, get_cblas_pc_module_name)
3030
from sage.misc.misc import SPYX_TMP, sage_makedirs
3131
from .temporary_file import tmp_filename
3232
from sage.repl.user_globals import get_globals
3333
from sage.misc.sage_ostools import restore_cwd, redirection
3434
from sage.cpython.string import str_to_bytes
3535

36-
37-
# CBLAS can be one of multiple implementations
38-
cblas_pc = pkgconfig.parse('cblas')
36+
cblas_pc = pkgconfig.parse(get_cblas_pc_module_name())
3937
cblas_libs = list(cblas_pc['libraries'])
4038
cblas_library_dirs = list(cblas_pc['library_dirs'])
4139
cblas_include_dirs = list(cblas_pc['include_dirs'])

src/sage_setup/library_order.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
# TODO: When #29706 is merged, simplify this module using the expanded cython_aliases.
99

1010
import pkgconfig
11+
from sage.env import get_cblas_pc_module_name
1112

12-
# CBLAS can be one of multiple implementations
13-
cblas_pc = pkgconfig.parse('cblas')
13+
# CBLAS
14+
cblas_pc = pkgconfig.parse(get_cblas_pc_module_name())
1415
cblas_libs = cblas_pc['libraries']
1516
cblas_library_dirs = cblas_pc['library_dirs']
1617
cblas_include_dirs = cblas_pc['include_dirs']

0 commit comments

Comments
 (0)