easybuilders / easybuild-framework

EasyBuild is a software installation framework in Python that allows you to install software in a structured and robust way.
https://easybuild.io
GNU General Public License v2.0
147 stars 198 forks source link

environment variables supporting empty string not avaialble in Lmod #997

Open ghost opened 9 years ago

ghost commented 9 years ago

configuration options supporting empty strings must alse be able to support either False, None or Empty such that these can be configured using e.g. Lmod modules. setenv('EASYBUILD_SUFFIX_MODULES_PATH', nil ) -- doesnt work.

Of course, could be a Lua trick im not aware. But for simplicity it should be supported.

boegel commented 9 years ago

@olavks: hmm, I'm missing the point here. What do you want achieve exactly here? Why not simply set $EASYBUILD_SUFFIX_MODULES_PATH to an empty string? That matches with your intention of using an empty suffix?

ghost commented 9 years ago

yes, not been able to have Lmod set empty variables... Could be something im missing. But right now I'm forced to stick with "all". or rename it. I cannot have it empty.

boegel commented 9 years ago

@rtmclay: how would you define an env var as empty in a Lua module?

rtmclay commented 9 years ago

You can't

boegel commented 9 years ago

Well, that's... unfortunate. @rtmclay: Are you aware of what the particular reason is for not having this supported?

rtmclay commented 9 years ago

There hasn't be much call for setting an env. var. be an empty string. In the shell it is not straightforward to tell the difference between a variable not being set and being set to "". Internally Lmod has always used an empty string as meaning to unset the variable.

From a program, I can see that one might want to store strings set to be an empty string. So I have modified Lmod to support this. You can now do:

setenv("EMPTY_STRING","")

to set a variable to have an empty string as a value.

This version is 5.7.3 at the git repo. Feel free to give this new version a test drive. This change passes all my regressions tests. But using an empty string to mark when a variable is to be unset has been part of the original design of Lmod. I may have missed a case or two. Please let me know if you find any that I've missed.

boegel commented 9 years ago

@olavks: any luck with trying Lmod 5.7.3 for setting env vars empty?

ghost commented 9 years ago

Yes, all the changes worked.

On 17 August 2014 20:40, Kenneth Hoste notifications@github.com wrote:

@olavks https://github.com/olavks: any luck with trying Lmod 5.7.3 for setting env vars empty?

— Reply to this email directly or view it on GitHub https://github.com/hpcugent/easybuild-framework/issues/997#issuecomment-52432368 .

boegel commented 9 years ago

@olavks: so, this can be closed then? (I prefer not closing issues opened by someone else)

ghost commented 9 years ago

That depends on if you think that there doesn't need to be False, None or Empty support for all options or not(not sure if its a good idea or not)?

On 18 August 2014 13:54, Kenneth Hoste notifications@github.com wrote:

@olavks https://github.com/olavks: so, this can be closed then (I prefer not closing issues opened by someone else)

— Reply to this email directly or view it on GitHub https://github.com/hpcugent/easybuild-framework/issues/997#issuecomment-52487684 .

boegel commented 9 years ago

@olavks: Picking up an old issue... I'm not sure what you mean by your last comment...

For most options, an empty matching environment variable $EASYBUILD_X has a meaning (e.g. equivalent to False or [] or None) , but maybe not for all. It basically depends on the "action" assigned to the option (see easybuild/tools/options.py), i.e. store, store_true, store_or_None, extend, etc. For options for which choice is specified an empty env var doesn't make sense (unless an empty value is a possible choice, of course).

Does that answer the question you had?