Skip to content

Check module extensions support within Tcl modulefiles#4978

Merged
boegel merged 3 commits intoeasybuilders:developfrom
xdelaruelle:extensions_cond_in_tcl_modfile
Aug 19, 2025
Merged

Check module extensions support within Tcl modulefiles#4978
boegel merged 3 commits intoeasybuilders:developfrom
xdelaruelle:extensions_cond_in_tcl_modfile

Conversation

@xdelaruelle
Copy link
Copy Markdown
Contributor

Instead of making EasyBuild check if module extensions are supported by module tool to generate the proper Tcl modulefiles, move this check directly within modulefile code, like done with Lua modulefiles.

It means module extensions code is always written in modulefile, but a condition guards it, to execute this code only if the version of the module tool evaluating the modulefile supports it.

So instead of checking the version of the module tool used by EasyBuild, the check is made on the module tool that evaluates the generated modulefiles.

With this new approach, the "supports_extensions" ModuleTool state is now useless thus it is removed.

Use the centrally defined REQ_VERSION_EXTENSIONS variable of ModuleTool
classes to build condition guard for module extensions in Lua
modulefiles.

Signed-off-by: Xavier Delaruelle <[email protected]>
Create a specific "check_version" method for ModuleGeneratorTcl class.
Module tool version is checked with "LMOD_VERSION" environment variable
for Lmod and "ModuleToolVersion" Tcl variable for Environment Modules.

"ModuleToolVersion" is available since Environment Modules 4.7.0, so it
is not possible to check a version below 4.7.0.

Signed-off-by: Xavier Delaruelle <[email protected]>
@xdelaruelle xdelaruelle force-pushed the extensions_cond_in_tcl_modfile branch from d4461ee to c193811 Compare August 12, 2025 18:22
@boegel boegel added this to the next release (5.1.2) milestone Aug 13, 2025
Comment thread easybuild/tools/module_generator.py
Instead of making EasyBuild check if module extensions are supported by
module tool to generate the proper Tcl modulefiles, move this check
directly within modulefile code, like done with Lua modulefiles.

It means module extensions code is always written in modulefile, but a
condition guards it, to execute this code only if the version of the
module tool evaluating the modulefile supports it.

So instead of checking the version of the module tool used by EasyBuild,
the check is made on the module tool that evaluates the generated
modulefiles.

Even with this new approach, the "supports_extensions" ModuleTool state
is kept to cope with older ModuleTool, like EnvironmentModulesC.

Signed-off-by: Xavier Delaruelle <[email protected]>
@xdelaruelle xdelaruelle force-pushed the extensions_cond_in_tcl_modfile branch from c193811 to 96be842 Compare August 13, 2025 13:27
Copy link
Copy Markdown
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@boegel boegel removed the change label Aug 19, 2025
@boegel boegel merged commit a4999c7 into easybuilders:develop Aug 19, 2025
37 checks passed
@xdelaruelle xdelaruelle deleted the extensions_cond_in_tcl_modfile branch August 19, 2025 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants