mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-07-01 03:39:39 +02:00
Python support added
This commit is contained in:
@@ -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)
|
||||
@@ -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@
|
||||
"
|
||||
|
||||
#
|
||||
|
||||
@@ -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"
|
||||
;;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user