mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-06-29 10:49:41 +02:00
cleanup in libmodules.tcl
- unused procedures removed - implementation of the output of the .info file moved to modulecmd.bash - swap is now implemented in modulecmd.bash as unload followed by a load
This commit is contained in:
@@ -78,18 +78,6 @@ proc module-addgroup { group } {
|
||||
remove-path UsedGroups $group
|
||||
debug "mode=remove: $env(UsedGroups)"
|
||||
}
|
||||
if { [module-info mode switch2] } {
|
||||
set dir [file join \
|
||||
$::PmodulesRoot \
|
||||
$group \
|
||||
$::PmodulesModulfilesDir \
|
||||
[module-info name]]
|
||||
if { [file isdirectory $dir] } {
|
||||
append-path MODULEPATH $dir
|
||||
}
|
||||
debug "mode=switch2: new MODULEPATH=$env(MODULEPATH)"
|
||||
append-path UsedGroups ${group}
|
||||
}
|
||||
}
|
||||
|
||||
proc set-family { group } {
|
||||
@@ -106,37 +94,6 @@ proc _pmodules_update_loaded_modules { group name version } {
|
||||
remove-path PMODULES_LOADED_${GROUP} "--APPMARKER--"
|
||||
}
|
||||
|
||||
#
|
||||
# load dependencies, but do *not* unload dependencies
|
||||
#
|
||||
proc _pmodules_load_dependencies { fname } {
|
||||
if { ! [ file exists ${fname} ] } {
|
||||
return
|
||||
}
|
||||
if { ! [module-info mode load] } {
|
||||
return
|
||||
}
|
||||
debug "load dependencies from: ${fname}"
|
||||
# Slurp up the data file
|
||||
set fp [open ${fname} r]
|
||||
set file_data [read ${fp}]
|
||||
close ${fp}
|
||||
set data [split ${file_data} "\n"]
|
||||
foreach line ${data} {
|
||||
debug "MODULEPATH=$::env(MODULEPATH)"
|
||||
set module_name [string trim $line]
|
||||
if { ${module_name} == "#" || ${module_name} == "" } {
|
||||
continue
|
||||
}
|
||||
if { [is-loaded ${module_name}] } {
|
||||
debug "module already loaded: ${module_name}"
|
||||
continue
|
||||
}
|
||||
debug "module load: ${module_name}"
|
||||
module load ${module_name}
|
||||
}
|
||||
}
|
||||
|
||||
proc lreverse_n { list n } {
|
||||
set res {}
|
||||
set i [expr [llength $list] - $n]
|
||||
@@ -354,15 +311,6 @@ proc _pmodules_init_global_vars { } {
|
||||
debug "group of module $name: $group"
|
||||
}
|
||||
|
||||
proc _pmodules_output_message { fname } {
|
||||
if { [ file exists "${fname}" ] } {
|
||||
set fp [open "${fname}" r]
|
||||
set info_text [read $fp]
|
||||
close $fp
|
||||
puts stderr ${info_text}
|
||||
}
|
||||
}
|
||||
|
||||
if { [info exists ::whatis] } {
|
||||
module-whatis "$whatis"
|
||||
}
|
||||
@@ -374,11 +322,6 @@ _pmodules_init_global_vars
|
||||
#
|
||||
conflict $name
|
||||
|
||||
if { [module-info mode load] } {
|
||||
debug "${name}/${version}: loading ... "
|
||||
_pmodules_output_message "${PREFIX}/.info"
|
||||
}
|
||||
|
||||
_pmodules_setenv ${PREFIX} ${name} ${version}
|
||||
_pmodules_update_loaded_modules ${group} ${name} ${version}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user