From 6f3187dd8e29b22b09a2bd133d51fe04feac4bbc Mon Sep 17 00:00:00 2001 From: Joost van Zwieten Date: Mon, 17 Oct 2022 23:01:24 +0200 Subject: [PATCH] use pathlib.Path in devtools/gha/configure_mkl.py --- devtools/gha/configure_mkl.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/devtools/gha/configure_mkl.py b/devtools/gha/configure_mkl.py index 9e0343f59..f4aa3eeb4 100644 --- a/devtools/gha/configure_mkl.py +++ b/devtools/gha/configure_mkl.py @@ -2,20 +2,21 @@ import sys import site import os +from pathlib import Path libsubdir = 'lib' -prefixes = list(site.PREFIXES) +prefixes = list(map(Path, site.PREFIXES)) if hasattr(site, 'getuserbase'): - prefixes.append(site.getuserbase()) + prefixes.append(Path(site.getuserbase())) -candidates = [os.path.join(prefix, libsubdir, 'libmkl_rt.so' + ext) for prefix in prefixes for ext in ('.1', '.2')] +candidates = [prefix / libsubdir / f'libmkl_rt.so{ext}' for prefix in prefixes for ext in ('.1', '.2')] for path in candidates: - if os.path.exists(path): + if path.exists(): break else: - log.error('cannot find any of {}'.format(' '.join(candidates))) + log.error('cannot find any of {}'.format(' '.join(map(str, candidates)))) raise SystemExit(1) -ld_library_path = os.pathsep.join(filter(None, (os.environ.get('LD_LIBRARY_PATH', ''), os.path.dirname(path)))) +ld_library_path = os.pathsep.join(filter(None, (os.environ.get('LD_LIBRARY_PATH', ''), str(path.parent)))) with open(os.environ['GITHUB_ENV'], 'a') as f: print('LD_LIBRARY_PATH={}'.format(ld_library_path), file=f)