init: remove compat version-related code

This commit is contained in:
Xavier Delaruelle
2021-07-21 14:16:56 +02:00
parent 3c68d6b636
commit 91380cdbee
14 changed files with 0 additions and 323 deletions

2
init/.gitignore vendored
View File

@@ -19,5 +19,3 @@
/modulespath
/profile.sh
/profile.csh
/profile-compat.sh
/profile-compat.csh

View File

@@ -53,17 +53,6 @@ _mlret=$?
if [ $_mlret -eq 0 ]; then
eval "$_mlcode"
@compatversion@ # redefine module command if compat version has been activated
@compatversion@ if [ "${MODULES_USE_COMPAT_VERSION:-0}" = '1' ]; then
@compatversion@ MODULES_CMD=@libexecdir@/modulecmd-compat
@compatversion@ export MODULES_CMD
@compatversion@ if [ -t 2 ]; then
@compatversion@ _module_raw() { eval `@libexecdir@/modulecmd-compat bash $*`; }
@compatversion@ else
@compatversion@ module() { eval `@libexecdir@/modulecmd-compat bash $*`; }
@compatversion@ fi
@compatversion@ fi
@compatversion@
# export functions to get them defined in sub-shells
if [ -t 2 ]; then
export -f _module_raw
@@ -73,35 +62,6 @@ if [ $_mlret -eq 0 ]; then
export -f ml
fi
@compatversion@ # define function to switch between C and Tcl versions of Modules
@compatversion@ switchml() {
@compatversion@ typeset swfound=1
@compatversion@ if [ "${MODULES_USE_COMPAT_VERSION:-0}" = '1' ]; then
@compatversion@ typeset swname='main'
@compatversion@ if [ -e @libexecdir@/modulecmd.tcl ]; then
@compatversion@ typeset swfound=0
@compatversion@ unset MODULES_USE_COMPAT_VERSION
@compatversion@ fi
@compatversion@ else
@compatversion@ typeset swname='compatibility'
@compatversion@ if [ -e @libexecdir@/modulecmd-compat ]; then
@compatversion@ typeset swfound=0
@compatversion@ MODULES_USE_COMPAT_VERSION=1
@compatversion@ export MODULES_USE_COMPAT_VERSION
@compatversion@ fi
@compatversion@ fi
@compatversion@
@compatversion@ # switch version only if command found
@compatversion@ if [ $swfound -eq 0 ]; then
@compatversion@ echo "Switching to Modules $swname version"
@compatversion@ source @initdir@/bash
@compatversion@ else
@compatversion@ echo "Cannot switch to Modules $swname version, command not found"
@compatversion@ return 1
@compatversion@ fi
@compatversion@ }
@compatversion@ export -f switchml
@compatversion@
# enable completion only in interactive mode
if [ ${BASH_VERSINFO:-0} -ge 3 ] && [[ $- =~ i ]] &&
[ -r @initdir@/bash_completion ]; then

View File

@@ -54,48 +54,6 @@ _module_long_arg_list() {
done
}
@compatversion@# define completion relative to active version
@compatversion@if [ "$MODULES_USE_COMPAT_VERSION" = '1' ]; then
@compatversion@_module() {
@compatversion@ local cur="$2" prev="$3" cmds opts
@compatversion@
@compatversion@ COMPREPLY=()
@compatversion@
@compatversion@ cmds="add apropos avail clear display del help\
@compatversion@ initadd initclear initlist initprepend initrm initswitch\
@compatversion@ keyword list load purge refresh remove rm show swap switch\
@compatversion@ unload unuse update use whatis"
@compatversion@
@compatversion@ opts="-c -f -h -i -l -s -t -u -v -H -V\
@compatversion@ --create --force --help --human --icase\
@compatversion@ --long --silent --terse --userlvl --verbose --version"
@compatversion@
@compatversion@ case "$prev" in
@compatversion@ add|load) COMPREPLY=( $(compgen -W "$(_module_not_yet_loaded)" -- "$cur") );;
@compatversion@ rm|del|remove|unload|switch|swap)
@compatversion@ COMPREPLY=( $(IFS=: compgen -W "${LOADEDMODULES}" -- "$cur") );;
@compatversion@ unuse) COMPREPLY=( $(IFS=: compgen -W "${MODULEPATH}" -- "$cur") );;
@compatversion@ use|*-a*) ;; # let readline handle the completion
@compatversion@ -u|--userlvl) COMPREPLY=( $(compgen -W "novice expert advanced" -- "$cur") );;
@compatversion@ av*|disp*|help|show|whatis)
@compatversion@ COMPREPLY=( $(compgen -W "$(_module_avail)" -- "$cur") );;
@compatversion@ *) if test $COMP_CWORD -gt 2
@compatversion@ then
@compatversion@ _module_long_arg_list "$cur"
@compatversion@ else
@compatversion@ case "$cur" in
@compatversion@ # The mappings below are optional abbreviations for convenience
@compatversion@ ls) COMPREPLY="list";; # map ls -> list
@compatversion@ r*) COMPREPLY="rm";; # also covers 'remove'
@compatversion@ sw*) COMPREPLY="switch";;
@compatversion@
@compatversion@ -*) COMPREPLY=( $(compgen -W "$opts" -- "$cur") );;
@compatversion@ *) COMPREPLY=( $(compgen -W "$cmds" -- "$cur") );;
@compatversion@ esac
@compatversion@ fi;;
@compatversion@ esac
@compatversion@}
@compatversion@else
_module() {
local cur="$2" prev="$3" cmds opts
@@ -214,5 +172,4 @@ if $(type -t ml >/dev/null); then
}
complete -o default -F _ml ml
fi
@compatversion@fi
complete -o default -F _module module

View File

@@ -33,21 +33,3 @@ if(EXISTS ${tempfile_name})
include(${tempfile_name})
file(REMOVE ${tempfile_name})
endif()
@compatversion@
@compatversion@# redefine module command if compat version has been activated
@compatversion@if("$ENV{MODULES_USE_COMPAT_VERSION}" STREQUAL "1")
@compatversion@ set(ENV{MODULES_CMD} "@libexecdir@/modulecmd-compat")
@compatversion@ function(module)
@compatversion@ execute_process(COMMAND mktemp -t moduleinit.cmake.XXXXXXXXXXXX
@compatversion@ OUTPUT_VARIABLE tempfile_name
@compatversion@ OUTPUT_STRIP_TRAILING_WHITESPACE)
@compatversion@ execute_process(COMMAND @libexecdir@/modulecmd-compat cmake ${ARGV}
@compatversion@ OUTPUT_FILE ${tempfile_name})
@compatversion@ if(EXISTS ${tempfile_name})
@compatversion@ include(${tempfile_name})
@compatversion@ file(REMOVE ${tempfile_name})
@compatversion@ endif()
@compatversion@ # return value as done on new main version
@compatversion@ set(module_result TRUE PARENT_SCOPE)
@compatversion@ endfunction(module)
@compatversion@endif()

View File

@@ -4,45 +4,8 @@ eval "`@TCLSH@ @libexecdir@/modulecmd.tcl @SHELLNAME@ autoinit`"
# no environment alteration if the above autoinit command failed
if ( $status == 0 ) then
@compatversion@ # clarify compat version is not enabled for below tests
@compatversion@ if ( ! $?MODULES_USE_COMPAT_VERSION ) then
@compatversion@ setenv MODULES_USE_COMPAT_VERSION 0
@compatversion@ endif
@compatversion@
@compatversion@ # redefine module command if compat version has been activated
@compatversion@ if ( "$MODULES_USE_COMPAT_VERSION" == '1' ) then
@compatversion@ setenv MODULES_CMD @libexecdir@/modulecmd-compat ;
@compatversion@ if ( $?histchars && $?prompt ) alias module 'set _histchars = $histchars; unset histchars; set _prompt=$prompt:q; set prompt=""; eval `@libexecdir@/modulecmd-compat @SHELLNAME@ \!*`; set _exit="$status"; set histchars = $_histchars; unset _histchars; set prompt=$_prompt:q; unset _prompt; test 0 = $_exit' ;
@compatversion@ if ( $?histchars && ! $?prompt ) alias module 'set _histchars = $histchars; unset histchars; eval `@libexecdir@/modulecmd-compat @SHELLNAME@ \!*`; set _exit="$status"; set histchars = $_histchars; unset _histchars; test 0 = $_exit' ;
@compatversion@ if ( ! $?histchars && $?prompt ) alias module 'set _prompt=$prompt:q; set prompt=""; eval `@libexecdir@/modulecmd-compat @SHELLNAME@ \!*`; set _exit="$status"; set prompt=$_prompt:q;unset _prompt; test 0 = $_exit' ;
@compatversion@ if ( ! $?histchars && ! $?prompt ) alias module 'eval `@libexecdir@/modulecmd-compat @SHELLNAME@ \!*`' ;
@compatversion@ endif
@compatversion@
@compatversion@ # define function to switch between C and Tcl versions of Modules
@compatversion@ set switchml_defined="`alias switchml`"
@compatversion@ if ( "$switchml_defined" == '' ) then
@compatversion@ alias switchml 'set swfound=1; \\
@compatversion@ if ( ! $?MODULES_USE_COMPAT_VERSION ) setenv MODULES_USE_COMPAT_VERSION 0; \\
@compatversion@ if ( "$MODULES_USE_COMPAT_VERSION" == "1" ) set swname="main"; \\
@compatversion@ if ( "$MODULES_USE_COMPAT_VERSION" == "1" && -e @libexecdir@/modulecmd.tcl ) set swfound=0; \\
@compatversion@ if ( "$MODULES_USE_COMPAT_VERSION" != "1" ) set swname="compatibility"; \\
@compatversion@ if ( "$MODULES_USE_COMPAT_VERSION" != "1" && -e @libexecdir@/modulecmd-compat ) set swfound=0; \\
@compatversion@ if ( $swfound == 0 && $swname == "main" ) setenv MODULES_USE_COMPAT_VERSION 0; \\
@compatversion@ if ( $swfound == 0 && $swname == "compatibility" ) setenv MODULES_USE_COMPAT_VERSION 1; \\
@compatversion@ if ( $swfound == 0 ) echo "Switching to Modules $swname version"; \\
@compatversion@ if ( $swfound == 0 ) source @initdir@/@SHELLNAME@; \\
@compatversion@ if ( $swfound != 0 ) echo "Cannot switch to Modules $swname version, command not found"; \\
@compatversion@ unset swfound swname;'
@compatversion@ endif
@compatversion@ unset switchml_defined
@compatversion@
if ( $?tcsh && $?prompt && -r @initdir@/tcsh_completion ) then
@compatversion@ if ( "$MODULES_USE_COMPAT_VERSION" != '1' ) then
source @initdir@/tcsh_completion
@compatversion@ else
@compatversion@ # no completion support on compat version
@compatversion@ uncomplete module
@compatversion@ endif
endif
@setbinpath@
@setbinpath@ if ( ":${PATH}:" !~ '*:@bindir@:*' ) then

View File

@@ -31,8 +31,6 @@ if [ $status -eq 0 ]
end
end
@compatversion@ # no switchml definition since there is no Fish support in C version
@compatversion@
@setbinpath@ if not contains @bindir@ $PATH
@setbinpath@@prependbinpath@ set -xg PATH @bindir@ $PATH
@setbinpath@@appendbinpath@ set -xg PATH $PATH @bindir@

View File

@@ -53,44 +53,6 @@ _mlret=$?
if [ $_mlret -eq 0 ]; then
eval "$_mlcode"
@compatversion@ # redefine module command if compat version has been activated
@compatversion@ if [ "${MODULES_USE_COMPAT_VERSION:-0}" = '1' ]; then
@compatversion@ MODULES_CMD=@libexecdir@/modulecmd-compat
@compatversion@ export MODULES_CMD
@compatversion@ if [ -t 2 ]; then
@compatversion@ _module_raw() { eval `@libexecdir@/modulecmd-compat ksh $*`; }
@compatversion@ else
@compatversion@ module() { eval `@libexecdir@/modulecmd-compat ksh $*`; }
@compatversion@ fi
@compatversion@ fi
@compatversion@
@compatversion@ # define function to switch between C and Tcl versions of Modules
@compatversion@ switchml() {
@compatversion@ typeset swfound=1
@compatversion@ if [ "${MODULES_USE_COMPAT_VERSION:-0}" = '1' ]; then
@compatversion@ typeset swname='main'
@compatversion@ if [ -e @libexecdir@/modulecmd.tcl ]; then
@compatversion@ typeset swfound=0
@compatversion@ unset MODULES_USE_COMPAT_VERSION
@compatversion@ fi
@compatversion@ else
@compatversion@ typeset swname='compatibility'
@compatversion@ if [ -e @libexecdir@/modulecmd-compat ]; then
@compatversion@ typeset swfound=0
@compatversion@ MODULES_USE_COMPAT_VERSION=1
@compatversion@ export MODULES_USE_COMPAT_VERSION
@compatversion@ fi
@compatversion@ fi
@compatversion@
@compatversion@ # switch version only if command found
@compatversion@ if [ $swfound -eq 0 ]; then
@compatversion@ echo "Switching to Modules $swname version"
@compatversion@ . @initdir@/ksh
@compatversion@ else
@compatversion@ echo "Cannot switch to Modules $swname version, command not found"
@compatversion@ return 1
@compatversion@ fi
@compatversion@ }
@setbinpath@
@setbinpath@ _mlinstr=":$PATH:"
@setbinpath@ if [ "${_mlinstr#*:@bindir@:}" = "$_mlinstr" ]; then

View File

@@ -26,16 +26,4 @@
@quarantinesupport@# clean temp variable used to setup quarantine
@quarantinesupport@undef $_mlre;
@quarantinesupport@
@compatversion@# redefine module command if compat version has been activated
@compatversion@if ($ENV{'MODULES_USE_COMPAT_VERSION'} eq '1') {
@compatversion@ $ENV{'MODULES_CMD'} = '@libexecdir@/modulecmd-compat';
@compatversion@ { no warnings 'redefine';
@compatversion@ *module = sub {
@compatversion@ eval `@libexecdir@/modulecmd-compat perl @_`;
@compatversion@ # return value as done on new main version
@compatversion@ return 1;
@compatversion@ };
@compatversion@ }
@compatversion@}
@compatversion@
1;

View File

@@ -1,8 +0,0 @@
# initialize compatibility version rather main version
setenv MODULES_USE_COMPAT_VERSION 1
if ($?tcsh) then
source @initdir@/tcsh
else
source @initdir@/csh
endif

View File

@@ -1,11 +0,0 @@
# initialize compatibility version rather main version
MODULES_USE_COMPAT_VERSION=1
export MODULES_USE_COMPAT_VERSION
shell=$(@BASENAME@ $(@PS@ -p $$ -ocomm=))
if [ -f @initdir@/$shell ]; then
source @initdir@/$shell
else
source @initdir@/sh
fi

View File

@@ -25,12 +25,3 @@ import os, re, subprocess
@quarantinesupport@
@quarantinesupport@# clean temp variable used to setup quarantine
@quarantinesupport@del _mlre
@compatversion@
@compatversion@# redefine module command if compat version has been activated
@compatversion@if 'MODULES_USE_COMPAT_VERSION' in os.environ and os.environ['MODULES_USE_COMPAT_VERSION'] == '1':
@compatversion@ os.environ['MODULES_CMD'] = '@libexecdir@/modulecmd-compat'
@compatversion@ # set module command in accordance with active version
@compatversion@ def module(command, *arguments):
@compatversion@ exec(subprocess.Popen(['@libexecdir@/modulecmd-compat', 'python', command] + list(arguments), stdout=subprocess.PIPE).communicate()[0])
@compatversion@ # return value as done on new main version
@compatversion@ return True

View File

@@ -24,20 +24,3 @@
# for MODULESHOME, MODULEPATH, LOADEDMODULES and parse of init config files)
@quarantinesupport@eval `#{_mlre}@TCLSH@ @libexecdir@/modulecmd.tcl ruby autoinit`
@notquarantinesupport@eval `@TCLSH@ @libexecdir@/modulecmd.tcl ruby autoinit`
@compatversion@
@compatversion@# redefine module command if compat version has been activated
@compatversion@if ENV['MODULES_USE_COMPAT_VERSION'] == '1' then
@compatversion@ ENV['MODULES_CMD'] = '@libexecdir@/modulecmd-compat'
@compatversion@ class ENVModule
@compatversion@ def ENVModule.module(*args)
@compatversion@ if args[0].kind_of?(Array) then
@compatversion@ args = args[0].join(' ')
@compatversion@ else
@compatversion@ args = args.join(' ')
@compatversion@ end
@compatversion@ eval `@libexecdir@/modulecmd-compat ruby #{args}`
@compatversion@ # return value as done on new main version
@compatversion@ return true
@compatversion@ end
@compatversion@ end
@compatversion@end

View File

@@ -53,17 +53,6 @@ _mlret=$?
if [ $_mlret -eq 0 ]; then
eval "$_mlcode"
@compatversion@ # redefine module command if compat version has been activated
@compatversion@ if [ "${MODULES_USE_COMPAT_VERSION:-0}" = '1' ]; then
@compatversion@ MODULES_CMD=@libexecdir@/modulecmd-compat
@compatversion@ export MODULES_CMD
@compatversion@ if [ -t 2 ]; then
@compatversion@ _module_raw() { eval `@libexecdir@/modulecmd-compat sh $*`; }
@compatversion@ else
@compatversion@ module() { eval `@libexecdir@/modulecmd-compat sh $*`; }
@compatversion@ fi
@compatversion@ fi
@compatversion@
# if sh is bash, export functions to get them defined in sub-shells
if [ "${BASH:-}" != '' ]; then
if [ -t 2 ]; then
@@ -75,37 +64,6 @@ if [ $_mlret -eq 0 ]; then
fi
fi
@compatversion@ # define function to switch between C and Tcl versions of Modules
@compatversion@ switchml() {
@compatversion@ swfound=1
@compatversion@ if [ "${MODULES_USE_COMPAT_VERSION:-0}" = '1' ]; then
@compatversion@ swname='main'
@compatversion@ if [ -e @libexecdir@/modulecmd.tcl ]; then
@compatversion@ swfound=0
@compatversion@ unset MODULES_USE_COMPAT_VERSION
@compatversion@ fi
@compatversion@ else
@compatversion@ swname='compatibility'
@compatversion@ if [ -e @libexecdir@/modulecmd-compat ]; then
@compatversion@ swfound=0
@compatversion@ MODULES_USE_COMPAT_VERSION=1
@compatversion@ export MODULES_USE_COMPAT_VERSION
@compatversion@ fi
@compatversion@ fi
@compatversion@
@compatversion@ # switch version only if command found
@compatversion@ if [ $swfound -eq 0 ]; then
@compatversion@ echo "Switching to Modules $swname version"
@compatversion@ . @initdir@/sh
@compatversion@ else
@compatversion@ echo "Cannot switch to Modules $swname version, command not found"
@compatversion@ return 1
@compatversion@ fi
@compatversion@ }
@compatversion@ if [ "${BASH:-}" != '' ]; then
@compatversion@ export -f switchml
@compatversion@ fi
@compatversion@
@setbinpath@ case ":$PATH:" in
@setbinpath@ *:@bindir@:*) ;;
@setbinpath@@prependbinpath@ *) PATH=@bindir@${PATH:+:}$PATH

View File

@@ -53,55 +53,11 @@ _mlret=$?
if [ $_mlret -eq 0 ]; then
eval "$_mlcode"
@compatversion@ # redefine module command if compat version has been activated
@compatversion@ if [ "${MODULES_USE_COMPAT_VERSION:-0}" = '1' ]; then
@compatversion@ MODULES_CMD=@libexecdir@/modulecmd-compat
@compatversion@ export MODULES_CMD
@compatversion@ if [ -t 2 ]; then
@compatversion@ _module_raw() { eval `@libexecdir@/modulecmd-compat zsh $*`; }
@compatversion@ else
@compatversion@ module() { eval `@libexecdir@/modulecmd-compat zsh $*`; }
@compatversion@ fi
@compatversion@ fi
@compatversion@
@compatversion@ # define function to switch between C and Tcl versions of Modules
@compatversion@ switchml() {
@compatversion@ typeset swfound=1
@compatversion@ if [ "${MODULES_USE_COMPAT_VERSION:-0}" = '1' ]; then
@compatversion@ typeset swname='main'
@compatversion@ if [ -e @libexecdir@/modulecmd.tcl ]; then
@compatversion@ typeset swfound=0
@compatversion@ unset MODULES_USE_COMPAT_VERSION
@compatversion@ fi
@compatversion@ else
@compatversion@ typeset swname='compatibility'
@compatversion@ if [ -e @libexecdir@/modulecmd-compat ]; then
@compatversion@ typeset swfound=0
@compatversion@ MODULES_USE_COMPAT_VERSION=1
@compatversion@ export MODULES_USE_COMPAT_VERSION
@compatversion@ fi
@compatversion@ fi
@compatversion@
@compatversion@ # switch version only if command found
@compatversion@ if [ $swfound -eq 0 ]; then
@compatversion@ echo "Switching to Modules $swname version"
@compatversion@ source @initdir@/zsh
@compatversion@ else
@compatversion@ echo "Cannot switch to Modules $swname version, command not found"
@compatversion@ return 1
@compatversion@ fi
@compatversion@ }
@compatversion@
@compatversion@ if [ "$MODULES_USE_COMPAT_VERSION" != '1' ]; then
# setup FPATH to put module completion at hand in case zsh completion enabled
if [[ ! ":$FPATH:" =~ ':@initdir@/zsh-functions:' ]]; then
FPATH=@initdir@/zsh-functions${FPATH:+:}$FPATH
export FPATH
fi
@compatversion@ # no completion support on compat version
@compatversion@ elif typeset -f compdef >/dev/null; then
@compatversion@ compdef -d module
@compatversion@ fi
@setbinpath@
@setbinpath@ if [[ ! ":$PATH:" =~ ':@bindir@:' ]]; then
@setbinpath@@prependbinpath@ PATH=@bindir@${PATH:+:}$PATH