-
Notifications
You must be signed in to change notification settings - Fork 211
Description
Issue
I'm trying to create a Gaussian EasyConfig which is inspired by https://github.com/easybuilders/easybuild-easyconfigs/pull/7553/files
However, rather than setting things like GAUSS_EXEDIR and GAUSS_BSDDIR explicitly in the EasyConfig, I'd prefer to follow the Gaussian installation instructions as closely as possible: they tell me to source (for bash) $env(EBROOTGAUSSIAN)/g16/bsd/g16.profile. (yes, I realize and accept that the downside of sourcing is that a module unload cannot undo it)
Our old-fashioned, manually created modules would contain something of this nature:
if { [module-info mode] == "load" } {
if { [ module-info shelltype ] == "csh" } {
puts stdout "source $env(EBROOTGAUSSIAN)/g16/bsd/g16.login ;"
} else {
puts stdout ". $env(EBROOTGAUSSIAN)/g16/bsd/g16.profile ;"
}
}
I've tried to recreate the same by specifying this as modtclfooter
. EasyBuild now generates a perfectly valid module file (which in fact, I can module load
just fine), but the EasyBuild installation procedure crashes during the check of the module file:
== 2019-09-20 18:21:58,646 build_log.py:163 ERROR EasyBuild crashed with an error (at ?:124 in __init__): Changing environment as dictated by module failed: invalid syntax (<string>, line 1) (stdout: source /home/casparl/.local/easybuild/RedHatEnterpriseServer7/2019/software/Gaussian/g16.b01/g16/bsd/g16.profile ;
import os
os.environ['EBVERSIONGAUSSIAN'] = 'g16.b01'
os.environ['LD_LIBRARY_PATH'] = '/home/casparl/.local/easybuild/RedHatEnterpriseServer7/2019/software/Gaussian/g16.b01/bsd:/home/casparl/.local/easybuild/RedHatEnterpriseServer7/2019/software/Gaussian/g16.b01/.'
os.environ['GAUSS_SCRDIR'] = '/scratch-shared/casparl/eb-1zSQIG'
...
What seems to be happening (looking at the 'import os' command there) is that EasyBuild is trying to change the environment in a Python interpreter context. Indeed, when I replace the puts stdout
by:
puts stdout "import os"
EasyBuild quite happily passes the 'sanity' check on the modulefile - I expect because in that case, it actually evaluates
import os
import os
os.environ['EBVERSIONGAUSSIAN'] = 'g16.b01'
in a Python context, which is perfectly valid. Of course, I don't have to tell you that the modulefile will actually now be invalid syntax, since it will evaluate the 'import os' in a bash shell. It's quite funny that EasyBuild crashes on a perfectly valid module syntax, but succeeds on a perfectly invalid one =)
Potential workaround
Here's where I'm stuck. The generated module file is perfectly valid tcl syntax. But, EasyBuild crashes on it. I'd like to be able to workaround this by convincing EasyBuild to 'skip' the step in which it tries to change the environment 'as dictated by the modulefile', so that it doesn't run into this error of evaluating tcl syntax in a Python interpreter... Is that somehow possible?
Potential solution
Ooof, even more difficult. As a first dirty fix, I think EasyBuild should maybe simply not try to evaluate the mod***footer
part. An improved, more complicated fix could somehow maybe evaluate this part strictly as tcl/lua syntax. I wouldn't know where to start in either case so I'm leaving this one up to the experts if you don't mind :)