Thanks. But the folders could be anywhere. I can't know them in advance.
On Fri, 16 Jul 2021 at 16:18, Xavier Delaruelle <xav...@gm...>
wrote:
> Hi Michael,
>
> Variant predefined values may be computed on the fly in the
> modulefile. So maybe if your projects shares predefined roots or if
> you know where to find them, you could set the code in the modulefile
> to create the list of valid project root values.
>
> $ mkdir /tmp/projects/{dir1,dir2,dir3} -p
> $ cat modulefiles/test
> #%Module
> set dir_list [glob -path /tmp/projects/ -tails *]
> variant root {*}$dir_list
>
> $ module show test root=dir1
> -------------------------------------------------------------------
> /path/to/modulefiles/test:
>
> variant root dir3 dir2 dir1
> -------------------------------------------------------------------
>
> Regards,
> Xavier
>
> Le ven. 16 juil. 2021 à 07:29, Michael Strelnikov
> <mic...@gm...> a écrit :
> >
> > Hi,
> >
> > I'm looking into the new features of modules and thinking how I can
> use the "variants".
> >
> > My original thought was to use it like "module load project [path to the
> root of project]". If I supply the path, it will take use it to set up
> variables and other tools. If I don't supply it, correct directory will be
> used.
> > But then I understood that the variants must have predefined values. So,
> my method will not work.
> > Are there other options I can use to achieve my goal?
> >
> > Thanks.
> > Michael
> > _______________________________________________
> > Modules-interest mailing list
> > Mod...@li...
> > https://lists.sourceforge.net/lists/listinfo/modules-interest
>
>
> _______________________________________________
> Modules-interest mailing list
> Mod...@li...
> https://lists.sourceforge.net/lists/listinfo/modules-interest
>
|