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
Add custom delimiter support for update_paths, hack in special case for TCLLIBPATH #4487
base: develop
Are you sure you want to change the base?
Conversation
@@ -247,7 +247,9 @@ def append_paths(self, key, paths, allow_abs=False, expand_relpaths=True): | |||
paths = self._filter_paths(key, paths) | |||
if paths is None: | |||
return '' | |||
return self.update_paths(key, paths, prepend=False, allow_abs=allow_abs, expand_relpaths=expand_relpaths) | |||
delim = ' ' if key == 'TCLLIBPATH' else ':' |
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 prefer to avoid conditionals on specific envars inside framework. It would be better to pass the delimiter as an extra option through modextrapaths
and the code here grabs any special delimiters or defaults to :
.
modextrapaths = {
'TCLLIBPATH': 'lib/tcl8.6',
'TCLLIBPATH': ('lib/tcl8.6', ' '),
'TCLLIBPATH': ['lib/tcl8.6'],
'TCLLIBPATH': (['lib/tcl8.6'], ' '),
}
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 hesitated with this approach since I felt that it would definitely be to ugly to expect module_generator.append_paths(key, paths)
to be passing in paths
as a tuple or something that.
Instead, if not hacky approach like this, I would add the delim
kwarg to append_paths
and prepend_paths
as well, and whatever login extracts the delimiter would need to happen in the easyblock instead, here:
easybuild-framework/easybuild/framework/easyblock.py
Lines 1416 to 1422 in 65591dd
for (key, value) in self.cfg['modextrapaths'].items(): | |
if isinstance(value, string_type): | |
value = [value] | |
elif not isinstance(value, (tuple, list)): | |
raise EasyBuildError("modextrapaths dict value %s (type: %s) is not a list or tuple", | |
value, type(value)) | |
lines.append(self.module_generator.prepend_paths(key, value, allow_abs=self.cfg['allow_prepend_abs_path'])) |
Note that currently, we allow (given the code above) for paths to be tuples as well as lists:
modextrapaths = {
'FOOPATH': ('multiple', 'paths'), # allowed today
}
with a tuple as well. So, that would certainly interfere with the options here. I don't think any easyconfigs use this, so, we could say that tuples are only for use with specifying a delimiter.
For reference, since this touches the same methods as EBPYTHONPREFIX to PYTHONPATH change, I will hold off doing any actual work here until that is merged for 5.0.x |
TCLLIBPATH (and nothing else as far as I know) requires spaces instead of : as the path delimiter.
Currently, the easyconfigs that set TCLLIBPATH are broken (if you load more than one)
See easybuilders/easybuild-easyconfigs#20197 (comment)
https://github.com/search?q=repo%3Aeasybuilders%2Feasybuild-easyconfigs%20TCLLIBPATH&type=code
BTL, Graphviz, bwidget.
I opted to just hack in the special case for TCLLIBPATH, but i suppose it could be brought up even further, somehow making this an option for the easyconfigs? I don't really see how one would do this though, where we would add such a field?
meh...
Disclaimer: completely untested.
Edit: and of course i should be adding a test, haven't had time.