One strategy that we have been using to achieve something similar is to use soft-links for each version-specific module. These version-specific modules all link to one "main" module file that implements the module logic. In this "main" module "module-info specified" can be used e.g. to map installation directories and similar. When the "main" module filename starts with a dot (i.e. '.main.module') it will also not show up during "module avail".
Best Regards,
Martin
-----Original Message-----
From: Sternberg, Michael G. via Modules-interest <mod...@li...>
Sent: Freitag, 26. Februar 2021 05:40
To: Environment Modules usage and discussion. <mod...@li...>
Cc: Sternberg, Michael G. <ste...@an...>
Subject: Re: [Modules] Get default version of module
[---EXTERNAL---]
The "module show foo" command could help to inspect the modulefile version and the full path that would be resolved for some module specification. Also, since you're sourcing, see the Modules-provided Tcl command "module-info specified" (literal) for the name requested on the command line.
But what are you trying to do?
I figure your generator script scans your application INSTALL_DIR and in effect represents it in the form of virtual modulefiles. If your motivation is to reduce code length or duplication, you could instead represent each application version by an actual modulefile containing a few appropriate Tcl "set" commands, then source a "main" modulefile for handling. Working with explicitly set variables should help to keep the tree and code simple and maintainable.
With best regards,
Michael
> On Feb 25, 2021, at 20:34, John Peter Yamauchi (jyamauchi) <jya...@mi...> wrote:
> Hi all,
> I’ve developed a system for my environment that auto-generates virtual modulefiles based on versions of tools that are installed. The modules all point to a single modulefile that parses out the tool and version name from the name of the virtual module to set environment variables.
>
> Loading these modules works without a hitch. However, sourcing them causes issues, since I have to pass in the path to the generic module. I am passing in the tool name, but I need to get the version name.
>
> Question: How do I determine the default version of a module?
>
> I can parse the name out by doing a `module avail -d <tool_name>`, except that doing `module avail <tool_name>` always behaves like --starts-with is enabled, so for a tool named `py` it will also return information on tools named `pyc`.
>
> Is there a more straightforward way to get the default version of a module for use in a script?
_______________________________________________
Modules-interest mailing list
Mod...@li...
https://lists.sourceforge.net/lists/listinfo/modules-interest
|