easybuild-framework
easybuild-framework copied to clipboard
refactor generation of required environment variables in module files
trafficstars
Goal is to lay groundwork to be able to fix #3331 and add new option to control which search path variables are added in modules by simplifying the code injecting environment variables to module files.
This PR should not alter the resulting module files to what is currently generated by EB. If it changes the list of environment variables it should have no effect (e.g. because those paths are empty).
Simplification of logic handling environment variables for module files:
- replace obscure rules defining which search paths require populated dirs with:
- all modules require search paths that point to existing files or non-empty dirs (fixes #3504)
- fake modules can have search paths to empty dirs
- replace obscure rules defining which search paths require files in their top level directory with:
- by default all search paths to directories can be populated at any level (recursive check)
- this setting is now controlled by
top_level_fileattribute ofModuleEnvironmentVariable
- replace convoluted rules to handle symlinked
lib64that generate duplicate paths and need explicit exceptions with:- paths to
lib64are always ignored iflib64is a symlink tolib - paths to
libare always ignored iflibis a symlink tolib64 - remove
lib32from list of library search paths
- paths to
- allow simple updates of environment variables in child EasyBlocks, replacing the clunky:
with an elegant:def make_module_req_guess(self): guesses = super(EB_Clang, self).make_module_req_guess() guesses.update({'SOME_VAR': ['some/path]}) return guessesself.module_load_environment.SOME_VAR = ['some/path']
Changelog:
- add
ModuleEnvironmentVariablepseudo-dataclass toeasybuild.tools.modulesto hold definitions of environment variables for modules - add
ModuleLoadEnvironmentsingleton class toeasybuild.tools.modulesto hold environment definition for modules on load - deprecate
EasyBlock.make_module_req_guessin favor ofModuleLoadEnvironment - add LibSymlink enum to
easybuild.framework.easyblockto define possible linkage states of lib directories - add
install_lib_symlinkattribute to EasyBlcok to keep track of symlink status between lib dirs - add globals to
easybuild.tools.configthat define known directories for binaries, libraries and headers - avoid changing the current working directory of the main process in
easyblock.make_module_reqby working with absolute paths instead