Skip to content

Commit 9a1c50b

Browse files
committed
Apply new tags set on loaded requirement
Update the loadRequirementModuleList procedure to apply tags defined on the first requirement found loaded.
1 parent 214f7ee commit 9a1c50b

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

tcl/main.tcl.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,8 @@ proc module {command args} {
517517
foreach arg $args {
518518
if {![is-loaded $arg] && ![is-loading $arg]} {
519519
lappend modlist $arg
520+
} else {
521+
lappend loadedmodlist $arg
520522
}
521523
}
522524
if {[info exists modlist]} {
@@ -526,6 +528,10 @@ proc module {command args} {
526528
set ret 0
527529
}
528530
}
531+
# update tags on already loaded modules
532+
if {[info exists loadedmodlist]} {
533+
cmdModuleTag $tag_list {*}$loadedmodlist
534+
}
529535
}
530536
}
531537
# register modulefiles to load as individual prereqs or all at

tcl/mfinterp.tcl.in

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,15 @@ proc prereq {args} {
17331733
loadRequirementModuleList $tag_list {*}$args
17341734
}
17351735

1736-
if {![is-loaded {*}$args] && ![is-loading {*}$args]} {
1736+
foreach mod $args {
1737+
# get first loaded or loading mod in args list
1738+
if {[set loadedmod [getLoadedMatchingName $mod returnfirst]] ne {} ||\
1739+
[set loadedmod [getLoadedMatchingName $mod returnfirst 1]] ne {}} {
1740+
break
1741+
}
1742+
}
1743+
1744+
if {$loadedmod eq {}} {
17371745
set retisreqlo [isModuleEvaluated reqlo $curmodnamevr {*}$args]
17381746
# report message on currently evaluated module message block
17391747
if {![set retiseval [isModuleEvaluated any $curmodnamevr {*}$args]] ||\
@@ -1763,6 +1771,9 @@ proc prereq {args} {
17631771
knerror $msg MODULES_ERR_GLOBALTOP
17641772
}
17651773
}
1774+
} elseif {![getConf auto_handling]} {
1775+
# apply missing tag to first loaded module found
1776+
cmdModuleTag $tag_list $loadedmod
17661777
}
17671778

17681779
return {}

tcl/modeval.tcl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,15 @@ proc restoreSettings {} {
615615
# load modules passed as args designated as requirement
616616
proc loadRequirementModuleList {tag_list args} {
617617
# calling procedure must have already parsed module specification in args
618-
if {![is-loaded {*}$args] && ![is-loading {*}$args]} {
618+
foreach mod $args {
619+
# get first loaded or loading mod in args list
620+
if {[set loadedmod [getLoadedMatchingName $mod returnfirst]] ne {} ||\
621+
[set loadedmod [getLoadedMatchingName $mod returnfirst 1]] ne {}} {
622+
break
623+
}
624+
}
625+
626+
if {$loadedmod eq {}} {
619627
set imax [llength $args]
620628
set prereqloaded 0
621629
# if prereq list specified, try to load first then
@@ -651,6 +659,9 @@ proc loadRequirementModuleList {tag_list args} {
651659
}
652660
# output held messages
653661
releaseHeldReport {*}$holdidlist
662+
} else {
663+
# apply missing tag to first loaded module found
664+
cmdModuleTag $tag_list $loadedmod
654665
}
655666
}
656667

0 commit comments

Comments
 (0)