[chapel-lang/chapel] Make our modulefile more compatible with Lmod

Branch: refs/heads/master
Revision: 13c11cc
Author: ronawho
Log Message:

Merge pull request #16251 from ronawho/more-lmod-module-compat

Make our modulefile more compatible with Lmod

[reviewed by @ben-albrecht]

The is-loaded command always returns false under Lmod, so switch to
using module-info mode load to determine if we’re loading or unloading
the module. I think this is the preferred way to do this even under Tcl,
at least based on the few results I was able to find online and by
looking at other Cray modulefiles.

I couldn’t find any info about is-loaded not working under Lmod, but I
had a hard time finding any relevant search results when I was trying to
look that up. No other Cray modulefiles use it, and I didn’t find much

Modified Files:
M util/build_configs/cray-internal/generate-modulefile.bash

Compare: https://github.com/chapel-lang/chapel/compare/d0adbc12b209...13c11ccf0aef