Skip to content

Commit

Permalink
fix deprecating of module_depends_on easyconfig parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
boegel committed Oct 6, 2024
1 parent 8c7bcd0 commit 05fe0d3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ def make_devel_module(self, create_in_builddir=False):
recursive_unload = self.cfg['recursive_module_unload']
depends_on = self.cfg['module_depends_on']
if depends_on is not None:
print_warning("easyconfig parameter module_depends_on is deprecated.")
self.log.deprecated("'module_depends_on' easyconfig parameter should not be used anymore", '6.0')
for key in os.environ:
# legacy support
if key.startswith(DEVEL_ENV_VAR_NAME_PREFIX):
Expand Down Expand Up @@ -1338,6 +1338,8 @@ def make_module_dep(self, unload_info=None):
# include load statements for retained dependencies
recursive_unload = self.cfg['recursive_module_unload']
depends_on = self.cfg['module_depends_on']
if depends_on is not None:
self.log.deprecated("'module_depends_on' easyconfig parameter should not be used anymore", '6.0')
loads = []
for dep in deps:
unload_modules = []
Expand Down
2 changes: 1 addition & 1 deletion easybuild/framework/easyconfig/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
'moduleclass': [MODULECLASS_BASE, 'Module class to be used for this software', MODULES],
'moduleforceunload': [False, 'Force unload of all modules when loading the extension', MODULES],
'moduleloadnoconflict': [False, "Don't check for conflicts, unload other versions instead ", MODULES],
'module_depends_on': [True, 'Use depends_on (Lmod 7.6.1+) for dependencies in generated module '
'module_depends_on': [None, 'Use depends_on (Lmod 7.6.1+) for dependencies in generated module '
'(implies recursive unloading of modules).', MODULES],
'recursive_module_unload': [None, "Recursive unload of all dependencies when unloading module "
"(True/False to hard enable/disable; None implies honoring "
Expand Down
12 changes: 7 additions & 5 deletions easybuild/tools/module_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def load_module(self, mod_name, recursive_unload=False, depends_on=None, unload_
:param mod_name: name of module to generate load statement for
:param recursive_unload: boolean indicating whether the 'load' statement should be reverted on unload
:param depends_on: use depends_on statements rather than (guarded) load statements (deprecated)
:param depends_on: use depends_on statements rather than (guarded) load statements (DEPRECATED)
:param unload_modules: name(s) of module to unload first
:param multi_dep_mods: list of module names in multi_deps context, to use for guarding load statement
"""
Expand Down Expand Up @@ -885,7 +885,7 @@ def load_module(self, mod_name, recursive_unload=None, depends_on=None, unload_m
:param mod_name: name of module to generate load statement for
:param recursive_unload: boolean indicating whether the 'load' statement should be reverted on unload
(if None: enable if recursive_mod_unload build option or depends_on is True)
:param depends_on: use depends_on statements rather than (guarded) load statements (deprecated)
:param depends_on: use depends_on statements rather than (guarded) load statements (DEPRECATED)
:param unload_modules: name(s) of module to unload first
:param multi_dep_mods: list of module names in multi_deps context, to use for guarding load statement
"""
Expand All @@ -896,7 +896,8 @@ def load_module(self, mod_name, recursive_unload=None, depends_on=None, unload_m
# Lmod 7.6.1+ supports depends-on which does this most nicely:
if (build_option('mod_depends_on') and self.modules_tool.supports_depends_on) or depends_on:
if depends_on is not None:
print_warning('Module generator load_module keyword parameter "depends_on" is deprecated.')
depr_msg = "'depends_on' argument of module generator method 'load_module' should not be used anymore"
self.log.deprecated(depr_msg, '6.0')
if not self.modules_tool.supports_depends_on:
raise EasyBuildError("depends-on statements in generated module are not supported by modules tool")
load_template = self.LOAD_TEMPLATE_DEPENDS_ON
Expand Down Expand Up @@ -1312,7 +1313,7 @@ def load_module(self, mod_name, recursive_unload=None, depends_on=None, unload_m
:param mod_name: name of module to generate load statement for
:param recursive_unload: boolean indicating whether the 'load' statement should be reverted on unload
(if None: enable if recursive_mod_unload build option or depends_on is True)
:param depends_on: use depends_on statements rather than (guarded) load statements (deprecated)
:param depends_on: use depends_on statements rather than (guarded) load statements (DEPRECATED)
:param unload_modules: name(s) of module to unload first
:param multi_dep_mods: list of module names in multi_deps context, to use for guarding load statement
"""
Expand All @@ -1324,7 +1325,8 @@ def load_module(self, mod_name, recursive_unload=None, depends_on=None, unload_m
# Lmod 7.6+ supports depends_on which does this most nicely:
if (build_option('mod_depends_on') and self.modules_tool.supports_depends_on) or depends_on:
if depends_on is not None:
print_warning('Module generator load_module keyword parameter "depends_on" is deprecated.')
depr_msg = "'depends_on' argument of module generator method 'load_module' should not be used anymore"
self.log.deprecated(depr_msg, '6.0')
if not self.modules_tool.supports_depends_on:
raise EasyBuildError("depends_on statements in generated module are not supported by modules tool")
load_template = self.LOAD_TEMPLATE_DEPENDS_ON
Expand Down

0 comments on commit 05fe0d3

Please sign in to comment.