Repository navigation
Add --regexp option to module-* commands and Lmod regex commands - #741
Merged
Merged
Conversation
After a modulefile or modulerc evaluation, the commands defined in the interpreter are compared to those initially recorded to recreate the interpreter if some are missing. Both lists were compared as strings, whereas "info commands" returns its result in an unspecified order. This order may change when procedures are defined then deleted by an evaluation. Interpreter was then recreated although all its commands were still there. It occurs with Tcl 9.1 as soon as two commands are added to the modulefile interpreter. Sort the two lists when they differ to only recreate the interpreter if their content is different. The spread test modulefiles and modulercs override the first procedure returned by "info procs" then check from another evaluation that this first procedure is still overridden, which assumes a stable order. Name explicitly the procedure they have always picked: auto_load_index. Assisted-by: Claude:claude-fable-5-2 Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
Hiding, forbidding, tagging or warning about a set of modules that do not share a common name or version prefix (e.g., all the "-debug" builds or version 1 of several software) requires one statement per module, as a module specification always starts with a module name. Add a --regexp option to module-hide, module-forbid, module-tag and module-warn to designate target modules with Tcl regular expressions matched against module name and version. It is similar to the module-hide-regex and module-forbid-regex commands of Lmod. When this option is set, all the module arguments of the command are regular expressions. As such expression may start with a dash (e.g., "-debug$"), an argument starting with this character that is not a known option is then taken as a regular expression instead of raising an invalid option error. Regular expressions cannot be indexed per module root name like module specifications, so they are recorded in dedicated structures and tested against every module looked at. Nagelfar reports an argument starting with a dash as a bad option, so the lint plugins hide this leading dash when --regexp is set. Syntax of module-forbid, module-tag and module-warn moves from option-value pairs to options with a declared value, to describe the valueless --regexp. Assisted-by: Claude:claude-fable-5-2 Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
Lmod provides the module-hide-regex and module-forbid-regex commands in its Tcl modulerc files to hide or forbid the modules matching a regular expression. A modulerc file using them raises an unknown command error when evaluated by Modules. Add these two commands as aliases of module-hide and module-forbid with --regexp option set, like hide-version and hide-modulefile are aliases of module-hide. They accept the same options than the command they rely on. Expressions are Tcl regular expressions whereas they are Lua patterns on Lmod. No translation is made between these syntaxes: expressions using constructs specific to Lua patterns have to be adapted. Assisted-by: Claude:claude-fable-5-2 Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
xdelaruelle
force-pushed
the
module-regexp-spec
branch
from
November 17, 2026 15:39
f0165de to
78f81f4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--regexpoption to themodule-hide,module-forbid,module-tagandmodule-warnmodulefile commands. When set, all the module arguments of the command are Tcl regular expressions matched against module name and version, which helps to target with a single statement modules that do not share a name or version prefix (e.g.,module-hide --regexp {-debug$}).-that is not a known option of the command is taken as a regular expression when--regexpis set, instead of raising an invalid option error. The Nagelfar lint plugins are adapted to accept such arguments.icaseconfiguration option. For hiding, the strongest matching level is retained. For tag properties (like the forbid message), a matching module specification has precedence over regular expressions, and among them the first one defined wins. Stickiness set through a regular expression is only satisfied by the reload of the same module.module-hide-regexandmodule-forbid-regexmodulerc commands, as aliases ofmodule-hide --regexpandmodule-forbid --regexp, to support modulerc files written for Lmod. Expressions are Tcl regular expressions whereas they are Lua patterns on Lmod: no translation is made between these syntaxes.