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.
Simplify guess of MODULESHOME location by more relying on 'make'
capabilities than 'perl'.
Adapt init scripts for the different shells to use the MODULESHOME
variable that is replaced during the 'make' process rather than
${MODULESHOME}, $env(MODULESHOME), etc.
By the way, use a replacement pattern closer to what 'configure' is using
with '@MODULESHOME@' rather than '$MODULESHOME' which was confusing in
shell scripts.
Python code used to define the module command (autoinit action) was
broken (syntax errors) and not Python3-compatible. Error rendering is
also fixed here for Python3 compliance. Code used to process x-resource
is adapted to comply with Python recommendation [1] (subprocess.Popen
should be used instead of os.popen).
Python init script is also modified by this commit to use same code as
the one generated by autoinit action with call to subprocess.Popen
rather than os.popen.
[1] https://docs.python.org/2/library/os.html#os.popen