From c0151877c42c86d0612e4e4b5afd28c16dc4ffd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20=C3=96hman?= Date: Thu, 19 Sep 2024 10:32:28 +0200 Subject: [PATCH] Rework logic for when to use depends-on --- easybuild/tools/module_generator.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/easybuild/tools/module_generator.py b/easybuild/tools/module_generator.py index c93df18ae5..7e764a7ce2 100644 --- a/easybuild/tools/module_generator.py +++ b/easybuild/tools/module_generator.py @@ -894,7 +894,9 @@ def load_module(self, mod_name, recursive_unload=None, depends_on=False, unload_ body.extend([self.unload_module(m).strip() for m in unload_modules]) load_template = self.LOAD_TEMPLATE # Lmod 7.6.1+ supports depends-on which does this most nicely: - if (build_option('mod_depends_on') or depends_on) and self.modules_tool.supports_depends_on: + if (build_option('mod_depends_on') and self.modules_tool.supports_depends_on or depends_on: + 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 body.append(load_template) @@ -1318,7 +1320,9 @@ def load_module(self, mod_name, recursive_unload=None, depends_on=False, unload_ load_template = self.LOAD_TEMPLATE # Lmod 7.6+ supports depends_on which does this most nicely: - if (build_option('mod_depends_on') or depends_on) and self.modules_tool.supports_depends_on: + if (build_option('mod_depends_on') and self.modules_tool.supports_depends_on or depends_on: + 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 body.append(load_template)