mirror of
https://github.com/envmodules/modules.git
synced 2026-06-10 00:56:30 +08:00
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.
13 lines
436 B
Plaintext
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@'
|