mirror of
https://github.com/envmodules/modules.git
synced 2026-06-10 00:56:30 +08:00
24 lines
674 B
Plaintext
24 lines
674 B
Plaintext
import os, subprocess
|
|
|
|
os.environ['MODULESHOME'] = '$MODULESHOME'
|
|
|
|
if 'TCLSH' in os.environ:
|
|
TCLSH=os.environ['TCLSH']
|
|
else:
|
|
if os.path.exists('/usr/bin/tclsh'):
|
|
TCLSH="/usr/bin/tclsh"
|
|
else:
|
|
if os.path.exists('/bin/tclsh') :
|
|
TCLSH="/bin/tclsh"
|
|
else:
|
|
TCLSH=""
|
|
|
|
if not 'MODULEPATH' in os.environ:
|
|
os.environ['MODULEPATH'] = '/mips/tools/freeware/modulefiles'
|
|
|
|
if not 'LOADEDMODULES' in os.environ:
|
|
os.environ['LOADEDMODULES'] = '';
|
|
|
|
def module(command, *arguments):
|
|
exec(subprocess.Popen([TCLSH, '$MODULESHOME/modulecmd.tcl', 'python', command] + list(arguments), stdout=subprocess.PIPE).communicate()[0])
|