Python support added

This commit is contained in:
2023-03-28 15:40:35 +02:00
parent 9df26cf312
commit 10d069cb14
5 changed files with 26 additions and 3 deletions
+14
View File
@@ -0,0 +1,14 @@
import os, re, subprocess
def module(*args):
os.environ['PMODULES_MODULEFILES_DIR']='modulefiles'
os.environ['PMODULES_CONFIG_DIR']='config'
pm_home=os.environ['PMODULES_HOME']
os.environ['PMODULES_DIR']=pm_home
modulecmd=os.path.join(pm_home, 'bin', 'modulecmd')
if type(args[0]) == type([]):
args = args[0]
else:
cmd = [modulecmd, 'python'] + list(args)
(output, error) = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()
exec(output)
+3 -2
View File
@@ -10,8 +10,9 @@ declare -A Help=()
# initialize help text of 'module --version'
Help['version']="
Pmodules @PMODULES_VERSION@ using Tcl Environment Modules @MODULES_VERSION@
Copyright GNU GPL v2
Pmodules @PMODULES_VERSION@
using Tcl Environment Modules
VERSION = @MODULES_VERSION@
"
#
+6
View File
@@ -55,6 +55,9 @@ export_env() {
csh | tcsh )
local -r fmt="setenv %s \"%s\"; "
;;
python )
local -r fmt="os.environ['%s'] = '%s'\n"
;;
* )
std::die 1 "Unsupported shell -- ${Shell}\n"
;;
@@ -2284,6 +2287,9 @@ case "$1" in
csh | tcsh )
declare Shell='csh'
;;
python )
declare Shell='python'
;;
* )
std::die 1 "${CMD}: unsupported shell -- $1\n"
;;
+2
View File
@@ -40,6 +40,7 @@ get_version() {
}
declare -rx PMODULES_VERSION=$(get_version 'Pmodules')
declare -rx MODULES_VERSION=$(get_version 'modules')
#-----------------------------------------------------------------------------
#
@@ -507,6 +508,7 @@ pmodules::install() {
install -m 0644 "${SRC_DIR}/bash" "${PMODULES_HOME}/init"
install -m 0644 "${SRC_DIR}/bash_completion" "${PMODULES_HOME}/init"
install -m 0644 "${SRC_DIR}/csh" "${PMODULES_HOME}/init"
install -m 0644 "${SRC_DIR}/Pmodules.py" "${PMODULES_HOME}/init"
install -m 0644 "${SRC_DIR}/zsh" "${PMODULES_HOME}/init"
install -m 0644 "${SRC_DIR}/libpbuild.bash" "${PMODULES_HOME}/lib"
+1 -1
View File
@@ -3,7 +3,7 @@ coreutils 8.31
findutils 4.7.0
getopt 1.1.6
gettext 0.21
modules 3.2.10.1
modules 3.2.10.2
Pmodules 1.0.0rc15
Tcl 8.6.13
tcllib 1.21