From f6ea0bd3a64a8758f1f5b2709db357b6922ff313 Mon Sep 17 00:00:00 2001 From: gsell Date: Fri, 23 Aug 2024 13:39:36 +0200 Subject: [PATCH] Merge branch '339-modulecmd-loading-lmod-files-as-dependencies-of-a-tcl-modulefile' into 'master' Resolve "modulecmd: loading Lmod files as dependencies of a Tcl modulefile" Closes #339 See merge request Pmodules/src!318 (cherry picked from commit af82391ef011036e1a1120e264d5bef9791f0194) dd14f9d3 modulecmd: loading Lmod modulefiles as deps of Tcl modulefile fixed Co-authored-by: gsell --- Pmodules/modulecmd.bash.in | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index f703c6a..1be23b3 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -658,10 +658,11 @@ USAGE: ' subcommand_load() { - local relstage='undef' - local current_modulefile='' - local prefix='' - local m='' + local -- relstage='undef' + local -- current_modulefile='' + local -- prefix='' + local -- m='' + local -A interp #...................................................................... # output load 'hints' @@ -873,6 +874,8 @@ subcommand_load() { # continue if already loaded [[ ":${LOADEDMODULES}:" == *:${m}:* ]] && continue + interp[${current_modulefile}]="${modulecmd}" + # show info file if exist local prefix='' get_module_prefix prefix "${current_modulefile}" @@ -884,6 +887,9 @@ subcommand_load() { deps_file="${prefix}/.dependencies" fi test -r "${deps_file}" && load_dependencies "$_" + + # load module + modulecmd="${interp[${current_modulefile}]}" local output='' output=$("${modulecmd}" 'bash' "${opts[@]}" 'load' \ "${current_modulefile}" 2> "${TmpFile}")