(re)Design of make_extension_string & friends
As pointed out in #4331 there is a bit of a weird design around the functions make_extension_string and its use in _generate_extensions_list in module_generator.py from #3697. The list of extensions is built (tuples of name/version), put in a list, joined to a string and then split again into a list. It can't be fixed without change the API and might break somebodies EasyBlock (no EasyBlock in the repo or in a PR touches this code right now).
It would be cleaner to keep it as a list and only convert to a string when it's really needed.
From @Flamefire:
I can't remember the exact reasons from back then but yes it seems make_extension_string isn't really needed. However we use the functionality in 2 places: EBEXTSLIST and modulegenerator::_generate_extension_list and maybe we anticipated that more things might use it.
BTW: _generate_extension_list vs _generate_extensions_list in module generator is also...confusing
Coming back to this
The list of extensions is built (tuples of name/version), put in a list, joined to a string and then split again into a list. It can't be fixed without change the API and might break somebodies EasyBlock
The idea was to have a customization point for easyblocks to specify extensions that are not in exts_list directly. One use case is for https://github.com/easybuilders/easybuild-easyblocks/pull/2386 where PerlModule should get an extra parameter included_modules
That is _make_extension_list.
We need that list formatted in various ways although the format is similar enough to warrant a method: make_extension_string:
-
$EBEXTSLISTFOOgets set by the EasyBlock class - The module description gets filled using this by the module generator
The module-generator however abuses that to get a list. It should rather use _make_extension_list but that currently is a "private" method and make_extension_string could be overridden.
Another issue is that we cannot achieve an extension being listed that is part of another extension using the current approach as we operate on cfg['exts_list'], not the instances but an instance is required for us to get e.g. included_modules
I think this is fully adressed with #4690?
PR #4690 merged, closing.