Skip to content

Commit 680e521

Browse files
committed
Load dependencies of SYSTEM toolchain by full name
This allows loading e.g. `GCCcore/12.3.0/ncurses/6.1` without loading the GCCcore/12.3.0 toolchain module. So we can use that as a dependency.
1 parent fd0a4ff commit 680e521

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

easybuild/tools/toolchain/toolchain.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,10 @@ def _load_toolchain_module(self, silent=False):
658658

659659
def _load_dependencies_modules(self, silent=False):
660660
"""Load modules for dependencies, and handle special cases like external modules."""
661-
dep_mods = [dep['short_mod_name'] for dep in self.dependencies]
661+
# For SYSTEM software we allow using dependencies from any toolchain so we need to use the full
662+
# module name to allow loading them in the hierarchical MNS
663+
mod_name_key = 'full_mod_name' if self.is_system_toolchain() else 'short_mod_name'
664+
dep_mods = [dep[mod_name_key] for dep in self.dependencies]
662665

663666
if self.dry_run:
664667
dry_run_msg("\nLoading modules for dependencies...\n", silent=silent)
@@ -667,7 +670,7 @@ def _load_dependencies_modules(self, silent=False):
667670

668671
# load available modules for dependencies, simulate load for others
669672
for dep, dep_mod_exists in zip(self.dependencies, mods_exist):
670-
mod_name = dep['short_mod_name']
673+
mod_name = dep[mod_name_key]
671674
if dep_mod_exists:
672675
self.modules_tool.load([mod_name])
673676
dry_run_msg("module load %s" % mod_name, silent=silent)
@@ -683,15 +686,15 @@ def _load_dependencies_modules(self, silent=False):
683686
self.modules_tool.load(dep_mods)
684687

685688
if self.dependencies:
686-
build_dep_mods = [dep['short_mod_name'] for dep in self.dependencies if dep['build_only']]
689+
build_dep_mods = [dep[mod_name_key] for dep in self.dependencies if dep['build_only']]
687690
if build_dep_mods:
688691
trace_msg("loading modules for build dependencies:")
689692
for dep_mod in build_dep_mods:
690693
trace_msg(' * ' + dep_mod)
691694
else:
692695
trace_msg("(no build dependencies specified)")
693696

694-
run_dep_mods = [dep['short_mod_name'] for dep in self.dependencies if not dep['build_only']]
697+
run_dep_mods = [dep[mod_name_key] for dep in self.dependencies if not dep['build_only']]
695698
if run_dep_mods:
696699
trace_msg("loading modules for (runtime) dependencies:")
697700
for dep_mod in run_dep_mods:
@@ -703,7 +706,7 @@ def _load_dependencies_modules(self, silent=False):
703706
self.modules.extend(dep_mods)
704707

705708
# define $EBROOT* and $EBVERSION* for external modules, if metadata is available
706-
for dep in [d for d in self.dependencies if d['external_module']]:
709+
for dep in (d for d in self.dependencies if d['external_module']):
707710
mod_name = dep['full_mod_name']
708711
metadata = dep['external_module_metadata']
709712
self.log.debug("Metadata for external module %s: %s", mod_name, metadata)
@@ -862,7 +865,7 @@ def prepare(self, onlymod=None, deps=None, silent=False, loadmod=True,
862865
if deps is None:
863866
deps = []
864867
self.dependencies = self._check_dependencies(deps, check_modules=loadmod)
865-
if not len(deps) == len(self.dependencies):
868+
if len(deps) != len(self.dependencies):
866869
self.log.debug("dep %s (%s)" % (len(deps), deps))
867870
self.log.debug("tc.dep %s (%s)" % (len(self.dependencies), self.dependencies))
868871
raise EasyBuildError('Not all dependencies have a matching toolchain version')

0 commit comments

Comments
 (0)