From fc0ddd39b80fe0eaefb2e7954464412d8dcd2676 Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Sun, 18 Oct 2020 21:20:16 +0200 Subject: [PATCH] Inhibit requirement record Inhibit prereq or conflict requirement record on module load, module unload or module switch if implicit_requirement option is disabled or --not-user option is set. Add an inhibit_req_record state to track whether requirement should be recorded or not. Fixes #260 --- modulecmd.tcl.in | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/modulecmd.tcl.in b/modulecmd.tcl.in index 6e0b4aca..695cc8b6 100644 --- a/modulecmd.tcl.in +++ b/modulecmd.tcl.in @@ -36,6 +36,7 @@ array set g_state_defs [list\ hiding_threshold {0}\ inhibit_errreport {0}\ inhibit_interp {0}\ + inhibit_req_record {}\ init_error_report {0}\ is_stderr_tty { initStateIsStderrTty}\ is_win { initStateIsWin}\ @@ -2666,6 +2667,10 @@ proc module {command args} { [currentCommandName]]) && $command eq {config}} { knerror "${msgprefix}Command '$command' not supported$tryhelpmsg" } + # no requirement should be recorded this module load/unload/switch cmd + if {$not_req || ![getConf implicit_requirement]} { + lappendState inhibit_req_record [currentEvalId] + } } # argument number check @@ -2990,6 +2995,10 @@ proc module {command args} { popCommandName popAlwaysReadFullFile + if {!$topcall && ($not_req || ![getConf implicit_requirement])} { + lpopState inhibit_req_record + } + # if called from top level render settings if any if {$topcall} { renderSettings @@ -3673,8 +3682,10 @@ proc conflict {args} { # parse module version specification set args [eval parseModuleVersionSpecifier 0 $args] - # register conflict list - eval setLoadedConflict "{$currentModule}" $args + # register conflict list unless record inhibited for current iterp context + if {[currentState inhibit_req_record] != [currentEvalId]} { + eval setLoadedConflict "{$currentModule}" $args + } foreach mod $args { # if the conflict module is loading and it does not correspond to @@ -3716,7 +3727,10 @@ proc prereq {args} { set args [eval parseModuleVersionSpecifier 0 $args] # register prereq list (sets of optional prereq are registered as list) - setLoadedPrereq $currentModule $args + # unless record inhibited for current iterp context + if {[currentState inhibit_req_record] != [currentEvalId]} { + setLoadedPrereq $currentModule $args + } # if dependency resolving is enabled try to load prereq if {[getConf auto_handling] && ![eval is-loaded $args] && ![eval\