Skip to content

Commit

Permalink
use pathlib.Path in devtools/gha/configure_mkl.py
Browse files Browse the repository at this point in the history
  • Loading branch information
joostvanzwieten committed Oct 21, 2022
1 parent 164f8d3 commit 6f3187d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions devtools/gha/configure_mkl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 6f3187d

Please sign in to comment.