Skip to content

Commit ef951d9

Browse files
committed
Add warning if wrappers are being overwritten
1 parent 539bb56 commit ef951d9

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

easybuild/tools/toolchain/toolchain.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,12 +1055,6 @@ def prepare_rpath_wrappers(self, rpath_filter_dirs=None, rpath_include_dirs=None
10551055
if os.path.exists(cmd_wrapper) and os.path.exists(orig_cmd) and os.path.samefile(orig_cmd, cmd_wrapper):
10561056
raise EasyBuildError("Refusing to create a fork bomb, which(%s) == %s", cmd, orig_cmd)
10571057

1058-
# it may be the case that the wrapper already exists if the user provides a fixed location to store
1059-
# the RPATH wrappers, in this case the wrappers will be overwritten as they do not yet appear in the
1060-
# PATH (`which(cmd)` does not "see" them). Warn that they will be overwritten.
1061-
if os.path.exists(cmd_wrapper):
1062-
_log.warning(f"Overwriting existing RPATH wrapper {cmd_wrapper}")
1063-
10641058
# enable debug mode in wrapper script by specifying location for log file
10651059
if build_option('debug') and not disable_wrapper_log:
10661060
rpath_wrapper_log = os.path.join(tempfile.gettempdir(), 'rpath_wrapper_%s.log' % cmd)
@@ -1077,7 +1071,15 @@ def prepare_rpath_wrappers(self, rpath_filter_dirs=None, rpath_include_dirs=None
10771071
'rpath_wrapper_log': rpath_wrapper_log,
10781072
'wrapper_dir': wrapper_dir,
10791073
}
1080-
write_file(cmd_wrapper, cmd_wrapper_txt)
1074+
1075+
# it may be the case that the wrapper already exists if the user provides a fixed location to store
1076+
# the RPATH wrappers, in this case the wrappers will be overwritten as they do not yet appear in the
1077+
# PATH (`which(cmd)` does not "see" them). Warn that they will be overwritten.
1078+
if os.path.exists(cmd_wrapper):
1079+
_log.warning(f"Overwriting existing RPATH wrapper {cmd_wrapper}")
1080+
write_file(cmd_wrapper, cmd_wrapper_txt, always_overwrite=True)
1081+
else:
1082+
write_file(cmd_wrapper, cmd_wrapper_txt)
10811083
adjust_permissions(cmd_wrapper, stat.S_IXUSR)
10821084

10831085
# prepend location to this wrapper to $PATH

0 commit comments

Comments
 (0)