-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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? |
@@ -962,7 +962,7 @@ def swap_module(self, mod_name_out, mod_name_in, guarded=True): | |||
:param mod_name_in: name of module to load (swap in) | |||
: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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 swap
commands with the only argument being the module to load in.module
is 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