From 9a6b9f0bc58c252771142acab01b659bea55abb6 Mon Sep 17 00:00:00 2001 From: Paul McCarthy Date: Mon, 11 Dec 2023 16:17:47 +0000 Subject: [PATCH] Allow separate blas/lapack library names/paths to be specified in site.cfg --- setup.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 1c5ed51..e5a6855 100644 --- a/setup.py +++ b/setup.py @@ -25,12 +25,17 @@ def run(self): exit(1) config = ConfigParser() config.read('site.cfg') + try: - libraries.extend([config['openblas']['library']]) - library_dirs.extend([config['openblas']['library_dir']]) - include_dirs.extend([config['openblas']['include_dir']]) -except KeyError as err: - print(f'\033[31mKeyError: cannot find the {err} key in the site.cfg file. See the site.cfg.example file for documentation\033[0m') + for lib in ('blas', 'lapack', 'openblas'): + if lib in config: + libraries.extend([config[lib]['library']]) + library_dirs.extend([config[lib]['library_dir']]) + include_dirs.extend([config[lib]['include_dir']]) + if len(libraries) == 0: + raise KeyError() +except Exception: + print(f'\033[31mCannot find BLAS/LAPACK/OpenBLAS paths in the site.cfg file. See the site.cfg.example file for documentation\033[0m') exit(1) if sys.platform.startswith('win32'):