Skip to content

Commit 62e0a28

Browse files
committed
only copy rpath_args.py script and use relative path to it when custom location for RPATH wrapper scripts is specified
1 parent 4606da6 commit 62e0a28

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

easybuild/tools/toolchain/toolchain.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,8 @@ def prepare_rpath_wrappers(self, rpath_filter_dirs=None, rpath_include_dirs=None
999999
# only enable logging by RPATH wrapper scripts in debug mode
10001000
enable_wrapper_log = build_option('debug')
10011001

1002+
copy_rpath_args_py = False
1003+
10021004
# always include filter for 'stubs' library directory,
10031005
# cfr. https://github.com/easybuilders/easybuild-framework/issues/2683
10041006
# (since CUDA 11.something the stubs are in $EBROOTCUDA/stubs/lib64)
@@ -1008,27 +1010,33 @@ def prepare_rpath_wrappers(self, rpath_filter_dirs=None, rpath_include_dirs=None
10081010
rpath_filter_dirs.append(lib_stubs_pattern)
10091011

10101012
# directory where all RPATH wrapper script will be placed;
1011-
# note: it's important to honor RPATH_WRAPPERS_SUBDIR, see is_rpath_wrapper method
10121013
if rpath_wrappers_dir is None:
1013-
wrappers_dir = os.path.join(tempfile.mkdtemp(), RPATH_WRAPPERS_SUBDIR)
1014+
wrappers_dir = tempfile.mkdtemp()
10141015
else:
1015-
wrappers_dir = os.path.join(rpath_wrappers_dir, RPATH_WRAPPERS_SUBDIR)
1016+
wrappers_dir = rpath_wrappers_dir
10161017
# disable logging in RPATH wrapper scripts when they may be exported for use outside of EasyBuild
10171018
enable_wrapper_log = False
1019+
# copy rpath_args.py script to sit alongside RPATH wrapper scripts
1020+
copy_rpath_args_py = True
1021+
1022+
# it's important to honor RPATH_WRAPPERS_SUBDIR, see is_rpath_wrapper method
1023+
wrappers_dir = os.path.join(wrappers_dir, RPATH_WRAPPERS_SUBDIR)
1024+
mkdir(wrappers_dir, parents=True)
10181025

10191026
# must also wrap compilers commands, required e.g. for Clang ('gcc' on OS X)?
10201027
c_comps, fortran_comps = self.compilers()
10211028

1022-
# copy rpath_args.py script along RPATH wrappers
1023-
# and use path for %(rpath_args)s template value relative to location of the RPATH wrapper script,
1024-
# to avoid that the RPATH wrapper scripts rely on a script that's located elsewhere;
1025-
# that's mostly important when RPATH wrapper scripts are retained to be used outside of EasyBuild
10261029
rpath_args_py = find_eb_script('rpath_args.py')
1027-
mkdir(wrappers_dir, parents=True)
1028-
copy_file(rpath_args_py, wrappers_dir)
1029-
# here we assume that each RPATH wrapper script is created in a separate subdirectory (see wrapper_dir below);
1030-
# ${TOPDIR} is defined in template RPATH wrapper script, refers to parent dir in which wrapper script is located
1031-
rpath_args_py = os.path.join('${TOPDIR}', '..', os.path.basename(rpath_args_py))
1030+
1031+
# copy rpath_args.py script along RPATH wrappers, if desired
1032+
if copy_rpath_args_py:
1033+
copy_file(rpath_args_py, wrappers_dir)
1034+
# use path for %(rpath_args)s template value relative to location of the RPATH wrapper script,
1035+
# to avoid that the RPATH wrapper scripts rely on a script that's located elsewhere;
1036+
# that's mostly important when RPATH wrapper scripts are retained to be used outside of EasyBuild;
1037+
# here we assume that each RPATH wrapper script is created in a separate subdirectory (see wrapper_dir below);
1038+
# ${TOPDIR} is defined in template RPATH wrapper script, refers to parent dir in which wrapper script is located
1039+
rpath_args_py = os.path.join('${TOPDIR}', '..', os.path.basename(rpath_args_py))
10321040

10331041
rpath_wrapper_template = find_eb_script('rpath_wrapper_template.sh.in')
10341042

0 commit comments

Comments
 (0)