TACC / Lmod

Lmod: An Environment Module System based on Lua, Reads TCL Modules, Supports a Software Hierarchy
http://lmod.readthedocs.org
Other
484 stars 124 forks source link

Location `SitePackage.lua` #101

Closed wpoely86 closed 8 years ago

wpoely86 commented 8 years ago

There is a default (without functionality) SitePackage.lua in the src dir of Lmod. The comments recommend not to overwrite it but use the LMOD_PACKAGE_PATH environment variable to specify the location.

I would like a way of specify the location without relying on env vars. As it's just a lua file, any location in which lua searches would do but the name SitePackage seems a bit very generic to drop it in /usr/lib/lua/...

So, I don't know what would be the best option, use another name, specify the location in myGlobals.lua or in the lmodrc.lua file? Thoughts @rtmclay @boegel ?

rtmclay commented 8 years ago

You have a couple of choices. Some would involve changes in the Lmod software and some don't.

One choice is to do what I do with the TACC rpm. I overwrite the Standard SitePackage.lua in the delivered location. That way there are no env vars required.

Another choice would be allow for support of say Lmod_SitePackage.lua to use standard search rules. But this requires changes to the code base.

Another choice would be to make Lmod extend the Lua search paths to include the same place that it looks for the admin file or lmodrc.lua.

If there is a way to avoid this I'd rather not extend the Lua search path as it may slow things down.

rtmclay commented 8 years ago

Of course the other way to do it is to extend LUA_PATH to point to where you want to find SitePackage.lua.

rtmclay commented 8 years ago

Another choice would be to set either LMOD_PACKAGE_PATH or LUA_PATH inside the module command.

    module() { LMOD_PACKAGE_PATH=... eval $($LMOD_CMD bash "$@"); }

But that won't work for csh.

wpoely86 commented 8 years ago

If you simple overwrite the package SitePackage.lua with the rpm, we will do the same :wink:

rtmclay commented 8 years ago

I updated the comments in src/SitePackage.lua to suggest two ways to make your own SitePackage.lua file be used. Either overwrite or use LMOD_PACKAGE_PATH.