Conversation
|
@becker33: this needs tests. |
|
Some of the pre-existing methods like Travis seems not to be kicking off though, and I unsuccessfully tried to make it start by closing and reopening. |
|
I was willing to test this PR but unfortunately it currently has conflict, so I' m unable to test. |
…lities into spack.util.module_cmd
…sh module definition on some systems
|
@luigi-calori I've rebased this on current develop, feel free to test it out and let me know what you think! |
Included BASH_FUNC_module() variable outside of typeset as a detection option This should work on bash even in restricted_shell mode Kept the typeset detection as an option in case the module function is not exported in bash Also added try statements to tests, with environment recreation in finally blocks.
They also caught a bug in the error handling code, fixed in this commit as well
|
@tgamblin After fighting with Travis for too long, I think this is ready now. |
This reverts commit a113101.
* Parse modules in a way that works for both lmod and tcl * added test and made method more robust * refactoring for pythonic clarity * Improved detection of 'module' shell function + refactored module utilities into spack.util.module_cmd * Improved regex to reject nested parentheses we are not prepared to handle * make tests backwards compatible with python 2.6 * Improved regex to account for sh being aliased to bash and used in bash module definition on some systems * Improve test compatibility with lmod * Added error for None module_cmd * Add test for get_module_cmd_from_which() Add test for get_module_cmd_from_which(). Add -c argument to Popen call to typeset -f module in get_module_cmd_from_bash(). * Increased detection options Included BASH_FUNC_module() variable outside of typeset as a detection option This should work on bash even in restricted_shell mode Kept the typeset detection as an option in case the module function is not exported in bash Also added try statements to tests, with environment recreation in finally blocks. * More tests added; some hackiness * increased test coverage for util/module_cmd
Fixes #2924
Supersedes #3111 (includes it with additional features)
Thanks to @skosukhin for #2426, which influenced this PR.
Changes:
modulecmd#2924 for use case)