Skip to content

Commit 5dc123a

Browse files
author
Samuel Moors
committed
replace path to python executable with python3 in RPATH wrappers for buildenv easyblock
1 parent 7f4eacd commit 5dc123a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

easybuild/easyblocks/generic/buildenv.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@
2828
2929
@author: Alan O'Cais (Juelich Supercomputing Centre)
3030
"""
31+
import glob
3132
import os
3233
import stat
3334

3435
from easybuild.easyblocks.generic.bundle import Bundle
35-
from easybuild.tools.filetools import adjust_permissions, copy_dir
36+
from easybuild.tools.filetools import adjust_permissions, apply_regex_substitutions, copy_dir
3637
from easybuild.tools.toolchain.toolchain import RPATH_WRAPPERS_SUBDIR
3738

3839

@@ -60,7 +61,11 @@ def install_step(self, *args, **kwargs):
6061
wrappers_dir = os.path.join(self.rpath_wrappers_dir, RPATH_WRAPPERS_SUBDIR)
6162
if os.path.exists(wrappers_dir):
6263
self.rpath_wrappers_dir = os.path.join(self.installdir, 'bin')
63-
copy_dir(wrappers_dir, os.path.join(self.rpath_wrappers_dir, RPATH_WRAPPERS_SUBDIR))
64+
rpath_wrappers_path = os.path.join(self.rpath_wrappers_dir, RPATH_WRAPPERS_SUBDIR)
65+
copy_dir(wrappers_dir, rpath_wrappers_path)
66+
wrapper_files = list(filter(os.path.isfile, glob.glob(os.path.join(rpath_wrappers_path, '*', '*'))))
67+
# replace path to Python executable with python3 in the wrappers
68+
apply_regex_substitutions(wrapper_files, [(r'^PYTHON_EXE=.*$', 'PYTHON_EXE=python3')], backup=False)
6469
# Make sure wrappers are readable/executable by everyone
6570
adjust_permissions(
6671
self.rpath_wrappers_dir,

0 commit comments

Comments
 (0)