From 3f0051152707c7949b0a10de745a655e8385a0e3 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Mon, 4 Aug 2025 16:21:30 +0200 Subject: [PATCH] modulecmd: cleanup code: unused variable Dir2OverlayMap --- Pmodules/libmodules.tcl | 5 ----- Pmodules/libpmodules.bash.in | 8 +------- Pmodules/modulecmd.bash.in | 3 +-- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/Pmodules/libmodules.tcl b/Pmodules/libmodules.tcl index 759ca4e..0019b76 100644 --- a/Pmodules/libmodules.tcl +++ b/Pmodules/libmodules.tcl @@ -28,12 +28,10 @@ set ::MODULEFILES_DIR "modulefiles" set ::ol_replacing "r" # variable derived from PMODULES_ENV -array set ::Dir2OverlayMap {} array set ::OverlayInfo {} set ::UsedGroups {} set ::UsedOverlays {} -debug "_pmodules_parse_pmodules_env" proc _pmodules_parse_pmodules_env { } { # # In this library we need the value of some BASH variables @@ -48,9 +46,6 @@ proc _pmodules_parse_pmodules_env { } { continue } switch $key { - Dir2OverlayMap { - array set ::Dir2OverlayMap [regsub -all {[]=[]} $value " "] - } OverlayInfo { set tmp_olinfo [regsub -all {[]=[]} $value " "] array set ::OverlayInfo $tmp_olinfo diff --git a/Pmodules/libpmodules.bash.in b/Pmodules/libpmodules.bash.in index 2d5be94..1bd6f74 100644 --- a/Pmodules/libpmodules.bash.in +++ b/Pmodules/libpmodules.bash.in @@ -6,7 +6,6 @@ declare -A GroupDepths=(['none']=0) declare -a Overlays=() declare -A OverlayInfo -declare -A Dir2OverlayMap # An overlay has a type defining the way modules in this overlay # make modules in the other overlays unavailable. @@ -68,7 +67,7 @@ compute_group_depth () { scan_groups () { : " (Re-)Scan available groups in the overlays $@ and compute group depth's. - Set GroupDepths[group] and Dir2OverlayMap[ol:dir]. + Set GroupDepths[group]. " local -- ol='' local -i depth=0 @@ -83,9 +82,6 @@ scan_groups () { compute_group_depth depth "${dir}" GroupDepths[$group]=${depth} fi - # :FIXME: do we need this? - Dir2OverlayMap[${dir}]="${ol}" - Dir2OverlayMap[${dir%/"${__MODULEFILES_DIR__}"*}]="${ol}" done done GroupDepths['none']=0 @@ -405,8 +401,6 @@ pm::read_config(){ if [[ -z "${OverlayInfo[${ol_name}:modulefiles_root]}" ]]; then OverlayInfo[${ol_name}:modulefiles_root]=${OverlayInfo[${ol_name}:install_root]} fi - local -- modulefiles_root=${OverlayInfo[${ol_name}:modulefiles_root]} - Dir2OverlayMap[${modulefiles_root}]="${ol_name}" } get_config(){ diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index d722daf..206c14b 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -67,7 +67,6 @@ declare -- ReleaseStages=':unstable:stable:deprecated:' # set releases which should be available after initialization declare -- DefaultReleaseStages='stable' -declare -A Dir2OverlayMap=() declare -A GroupDepths=() declare -- ModulePathAppend='' declare -- ModulePathPrepend='' @@ -164,7 +163,7 @@ save_env() { vars+=( 'Overlays' ) vars+=( 'UsedOverlays' ) vars+=( 'OverlayExcludes' ) - vars+=( 'OverlayInfo' 'Dir2OverlayMap') + vars+=( 'OverlayInfo' ) vars+=( 'PmFiles' ) vars+=( 'ModulePathAppend' ) vars+=( 'ModulePathPrepend' )