Use one argument 'module swap' statements in Tcl modulefiles (required by Modules 4.2.3+)#3397
Conversation
|
Looks like it fails with older Modules versions. Something else is needed? |
| :param guarded: guard 'swap' statement, fall back to 'load' if module being swapped out is not loaded | ||
| """ | ||
| body = "module swap %s %s" % (mod_name_out, mod_name_in) | ||
| body = "module swap %s" % (mod_name_in) |
There was a problem hiding this comment.
@welucas2 It's probably worth adding a comment above here to explain why we use single argument swap commands.
Before we didn't have a good reason to use swap foo foo/<version> rather than swap foo/<version> I think, but now we clearly do, so it's worth mentioning that I think...
I'll also check with the other module tools we support whether single argument swap works for those, I'm not sure that's covered by the test suite right now (we just do a text comparison of the generated module file in the tests currently).
module swap in Tcl modulefiles…e argument 'module swap' in Tcl module files
…nt Tcl-only modules tool (version 1.x)
boegel
left a comment
There was a problem hiding this comment.
I've updated this PR with a small update to test_swap that verifies for which module tools the single-argument swap works.
It's fine for everything except for the ancient Tcl-only modules tool version 1.x, which we don't really care about anymore (I'll deprecate the support for that in a separate PR).
I'll go ahead and merge this PR as soon as CI gives the green light, thanks for diving into this yourself @welucas2!
|
I've also verified that single-arg swap in Thanks again @welucas2! |
This should address #3396 by generating modulefiles which use
module swapcommands with the only argument being the module to load in.moduleis intelligent enough to know which module should be unloaded, and this doesn't result in conflicting modules (and so unusable modulefiles) which occurs with Modules 4.2.3 and newer.edit: fixes #3396