From 49aa32f4dfb5f8ef52b50418d47ab6e4de3f5da3 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 9 Jun 2021 09:58:47 +0200 Subject: [PATCH 1/4] modulecmd: set defaults for DefaultGroups, etc - defaults are set for DefaultsGroups, DefaultReleaseStages and ReleaseStages --- Pmodules/modulecmd.bash.in | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 57bd58e..e5c9f2e 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -60,11 +60,29 @@ declare -A Help declare -r pmodules_config_file="${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/Pmodules.conf" +# the following settings are used if the Pmodules.conf is not available + +# set groups which should be available after initialization +declare -- DefaultGroups='Tools Programming' + +# define available release stages +declare -- ReleaseStages=':unstable:stable:deprecated:' + +# set releases which should be available after initialization +declare -- DefaultReleaseStages='stable' + +# In the dictionary Help we store the help text of each single command +# and for displaying the version. + +# initialize help text of 'module --version' Help['version']=" Pmodules @PMODULES_VERSION@ using Tcl Environment Modules @MODULES_VERSION@ Copyright GNU GPL v2 " +# +# display help text for command given in $1 +# print_help() { echo -e "${Help[$1]}" 1>&2 std::die 1 From 12a5fcd8728cb457e9ca0f3ec89940aad259125c Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 9 Jun 2021 10:00:34 +0200 Subject: [PATCH 2/4] modulecmd: fix in 'unuse' help text --- Pmodules/modulecmd.bash.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index e5c9f2e..fd74b0c 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1238,7 +1238,7 @@ Options[unuse]='-o H -l help' Help[unuse]=' unuse directory|group|release... Remove the given modulefiles directory, group, release stage, - flag or overlay from the search path. + flag from the search path. ' subcommand_unuse() { From 4ef135c6ab9c626fc9d714e441518de869bd5de7 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 9 Jun 2021 10:01:13 +0200 Subject: [PATCH 3/4] modulecmd: soure Pmodules.conf only if exist and readable --- Pmodules/modulecmd.bash.in | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index fd74b0c..c6d822b 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1421,10 +1421,11 @@ init_manpath() { } pmodules_init() { - source "${pmodules_config_file}" || \ - std::die 3 "Oops: cannot parse config file -- %s\n" \ - "${pmodules_config_file}" - + if [[ -r "${pmodules_config_file}" ]]; then + source "${pmodules_config_file}" || \ + std::die 3 "Oops: cannot parse config file -- %s\n" \ + "${pmodules_config_file}" + fi declare -gx LOADEDMODULES='' declare -gx _LMFILES_='' declare -gx UsedGroups='' From d4132018d1175358895f34bae6a9e80186b13418 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 9 Jun 2021 10:01:47 +0200 Subject: [PATCH 4/4] modulecmd: do not source Pmodules.conf if PMODULES_ENV exist - if PMODULES_ENV is set but DefaultGroups, DefaultReleaseStages or ReleaseStages is not set in PMODULES_ENV, the the default defined in modulecmd is used --- Pmodules/modulecmd.bash.in | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index c6d822b..dde1dd8 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -2326,12 +2326,6 @@ if [[ -n ${PMODULES_ENV} ]]; then fi g_env_must_be_saved='yes' fi - if [[ -v DefaultGroups ]] || [[ -v DefaultReleaseStages ]] || [[ -v ReleaseStages ]]; then - source "${pmodules_config_file}" || \ - std::die 3 "Oops: cannot parse config file -- %s\n" \ - "${pmodules_config_file}" - - fi else pmodules_init fi