mirror of
https://github.com/envmodules/modules.git
synced 2026-06-10 00:56:30 +08:00
25 lines
666 B
Plaintext
25 lines
666 B
Plaintext
import os, string
|
|
|
|
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):
|
|
commands = os.popen('$TCLSH $MODULESHOME/modulecmd.tcl python %s %s' % (command, string.join(arguments))).read()
|
|
exec(commands)
|