Files
modules/init/python.in
Xavier Delaruelle 14575a3497 init: get and set TCLSH in init scripts
As for MODULESHOME, get 'tclsh' location from Makefile then replace
'@TCLSH@' pattern in shell init scripts with found location rather than
guessing it in the init scripts.

By doing so, same 'tclsh' location search is applied to all init
scripts. Search is performed with 'command' to look at a predefined list
of PATHs in order to be resilient to the current PATH content.
2017-03-05 09:21:59 +01:00

13 lines
436 B
Plaintext

import os, subprocess
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])
os.environ['MODULESHOME'] = '@MODULESHOME@'