Skip to content

Commit c9d0ac3

Browse files
committed
Split isLoadedMatchSpecificPath with specific proc for loading
1 parent 9741682 commit c9d0ac3

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

tcl/modeval.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ proc getDirectDependentList {mod {strong 0} {nporeq 0} {loading 0}\
451451
set moddep 0
452452
foreach modpre $prereq {
453453
foreach lmmod $modlist {
454-
if {[isLoadedMatchSpecificPath $lmmod $prereq_path_list 0]\
454+
if {[isLoadedMatchSpecificPath $lmmod $prereq_path_list]\
455455
&& [modEq $modpre $lmmod eqstart 1 2 1]} {
456456
lappend lmprelist $lmmod
457457
if {$lmmod eq $mod} {

tcl/modfind.tcl.in

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,11 +1460,13 @@ proc getLoadedMatchingName {name {behavior {}} {loading 0} {lmlist {}}\
14601460
if {$loading} {
14611461
set isModulefileLoaded isModulefileLoading
14621462
set getModuleFromLoadedModulefile getModuleFromLoadingModulefile
1463+
set isLoadedMatchSpecificPath isLoadingMatchSpecificPath
14631464
set getLoadedModuleList [list getLoadingModuleList]
14641465
} else {
14651466
##nagelfar ignore #4 Found constant
14661467
set isModulefileLoaded isModulefileLoaded
14671468
set getModuleFromLoadedModulefile getModuleFromLoadedModulefile
1469+
set isLoadedMatchSpecificPath isLoadedMatchSpecificPath
14681470
set getLoadedModuleList [list getEnvLoadedModulePropertyParsedList name]
14691471
}
14701472

@@ -1510,7 +1512,7 @@ proc getLoadedMatchingName {name {behavior {}} {loading 0} {lmlist {}}\
15101512
set matchmod $mod
15111513
}
15121514
# test module matches specified modulepaths
1513-
if {![isLoadedMatchSpecificPath $mod $modulepath_list $loading]} {
1515+
if {![$isLoadedMatchSpecificPath $mod $modulepath_list]} {
15141516
continue
15151517
}
15161518
if {[modEq $name $matchmod eqstart 1 [expr {$loading ? 1 : 2}] 1]} {
@@ -1537,14 +1539,14 @@ proc getLoadedMatchingName {name {behavior {}} {loading 0} {lmlist {}}\
15371539
return $ret
15381540
}
15391541

1540-
# return if loaded (or loading) module is part of modulepath from specified
1541-
# constrained list
1542-
proc isLoadedMatchSpecificPath {mod modulepath_list loading} {
1543-
if {$loading} {
1544-
set mod_file [getModulefileFromLoadingModule $mod]
1545-
} else {
1546-
set mod_file [getModulefileFromLoadedModule $mod]
1547-
}
1542+
# return if loaded mod is part of modulepath from specified constrained list
1543+
proc isLoadedMatchSpecificPath {mod modulepath_list} {
1544+
set mod_file [getModulefileFromLoadedModule $mod]
1545+
return [isModulefileMatchSpecificPath $mod_file $modulepath_list]
1546+
}
1547+
1548+
proc isLoadingMatchSpecificPath {mod modulepath_list} {
1549+
set mod_file [getModulefileFromLoadingModule $mod]
15481550
return [isModulefileMatchSpecificPath $mod_file $modulepath_list]
15491551
}
15501552

@@ -1668,7 +1670,7 @@ proc getModuleLoadedConflict {mod {modulepath_list {}}} {
16681670
}
16691671

16701672
if {[isOtherVariantOfModuleLoaded $mod] || ([isModuleLoaded $mod] &&\
1671-
![isLoadedMatchSpecificPath $mod $modulepath_list 0])} {
1673+
![isLoadedMatchSpecificPath $mod $modulepath_list])} {
16721674
lappend mod_con_list [getModuleNameAndVersFromVersSpec $mod]
16731675
}
16741676

@@ -2062,7 +2064,7 @@ proc setModuleDependency {mod} {
20622064
foreach modpre $prereq {
20632065
set lmfound {}
20642066
foreach lmmod $modlist {
2065-
if {[isLoadedMatchSpecificPath $lmmod $prereq_path_list 0] &&\
2067+
if {[isLoadedMatchSpecificPath $lmmod $prereq_path_list] &&\
20662068
[modEq $modpre $lmmod eqstart 1 2 1]} {
20672069
set lmfound $lmmod
20682070
break
@@ -2082,7 +2084,7 @@ proc setModuleDependency {mod} {
20822084

20832085
# look if requirement can be found in the No Particular Order list
20842086
foreach lmmod $modnpolist {
2085-
if {[isLoadedMatchSpecificPath $lmmod $prereq_path_list 0] &&\
2087+
if {[isLoadedMatchSpecificPath $lmmod $prereq_path_list] &&\
20862088
[modEq $modpre $lmmod eqstart 1 2 1]} {
20872089
appendNoDupToList lmnpolist $lmmod
20882090
break
@@ -2145,7 +2147,7 @@ proc setModuleDependency {mod} {
21452147
if {[modEq $modpre $mod eqstart 1 2 1]} {
21462148
reportDebug "refresh requirements targeting '$modpre'"
21472149
foreach {lmmod prereq_path_list} $::g_unmetDepHash($modpre) {
2148-
if {![isLoadedMatchSpecificPath $mod $prereq_path_list 0]} {
2150+
if {![isLoadedMatchSpecificPath $mod $prereq_path_list]} {
21492151
continue
21502152
}
21512153
if {$mod in [getDependentLoadedModuleList [list $lmmod] 0 0]} {

tcl/subcmd.tcl.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,8 +1168,9 @@ proc cmdModuleLoad {context uasked tryload loadany tag_list modulepath_list\
11681168
if {$isloaded || $isloading} {
11691169
# stop if same mod is loaded but from a modulepath not part of
11701170
# constrained list
1171-
if {![isLoadedMatchSpecificPath $modname $modulepath_list [expr\
1172-
{!$isloaded}]]} {
1171+
if {($isloaded && ![isLoadedMatchSpecificPath $modname\
1172+
$modulepath_list]) || ($isloading &&\
1173+
![isLoadingMatchSpecificPath $modname $modulepath_list])} {
11731174
# no error if ConUn mechanism handles unload of this module
11741175
if {![getConf auto_handling] || ![getConf conflict_unload] ||\
11751176
$isloading} {

0 commit comments

Comments
 (0)