From 13850b24a8e46dbf6f3cd2d0a8bb915a119d52c3 Mon Sep 17 00:00:00 2001 From: Maxime Boissonneault Date: Wed, 23 Aug 2023 19:51:23 +0000 Subject: [PATCH] add set_shell_function to module_generator --- easybuild/tools/module_generator.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/easybuild/tools/module_generator.py b/easybuild/tools/module_generator.py index 70ee2ff7d5..316ff76d03 100644 --- a/easybuild/tools/module_generator.py +++ b/easybuild/tools/module_generator.py @@ -514,6 +514,12 @@ def set_alias(self, key, value): """ raise NotImplementedError + def set_shell_function(self, key, bashStr, cshStr): + """ + Generate set_shell_function statement in modulefile for the given key/value pair. + """ + raise NotImplementedError + def set_as_default(self, module_dir_path, module_version, mod_symlink_paths=None): """ Set generated module as default module @@ -1005,6 +1011,12 @@ def set_alias(self, key, value): # quotes are needed, to ensure smooth working of EBDEVEL* modulefiles return 'set-alias\t%s\t\t%s\n' % (key, quote_str(value, tcl=True)) + def set_shell_function(self, key, bashStr, cshStr): + """ + Generate set_shell_function statement in modulefile for the given key/value pair. + """ + raise NotImplementedError + def set_as_default(self, module_dir_path, module_version, mod_symlink_paths=None): """ Create a .version file inside the package module folder in order to set the default version for TMod @@ -1480,6 +1492,13 @@ def set_alias(self, key, value): # quotes are needed, to ensure smooth working of EBDEVEL* modulefiles return 'set_alias("%s", %s)\n' % (key, quote_str(value)) + def set_shell_function(self, key, bashStr, cshStr): + """ + Generate set_shell_function statement in modulefile for the given key/value pair. + """ + # quotes are needed, to ensure smooth working of EBDEVEL* modulefiles + return 'set_shell_function("%s", %s, %s)\n' % (key, quote_str(bashStr), quote_str(cshStr)) + def set_as_default(self, module_dir_path, module_version, mod_symlink_paths=None): """ Create a symlink named 'default' inside the package's module folder in order to set the default module version