Skip to content

Commit c4e1f16

Browse files
committed
Load SYSTEM modules by short name
No need to use the full name for e.g. GCCcore/GCC which are in Core/GCC.
1 parent 9cf0d20 commit c4e1f16

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

easybuild/tools/toolchain/toolchain.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -689,8 +689,13 @@ def _load_dependencies_modules(self, silent=False):
689689
"""Load modules for dependencies, and handle special cases like external modules."""
690690
# For SYSTEM software we allow using dependencies from any toolchain so we need to use the full
691691
# module name to allow loading them in the hierarchical MNS
692-
mod_name_key = 'full_mod_name' if self.is_system_toolchain() else 'short_mod_name'
693-
dep_mods = [dep[mod_name_key] for dep in self.dependencies]
692+
is_system_toolchain = self.is_system_toolchain()
693+
694+
def get_module_name(dep):
695+
key = 'full_mod_name' if is_system_toolchain and not dep[SYSTEM_TOOLCHAIN_NAME] else 'short_mod_name'
696+
return dep[key]
697+
698+
dep_mods = [get_module_name(dep) for dep in self.dependencies]
694699

695700
if self.dry_run:
696701
dry_run_msg("\nLoading modules for dependencies...\n", silent=silent)
@@ -699,7 +704,7 @@ def _load_dependencies_modules(self, silent=False):
699704

700705
# load available modules for dependencies, simulate load for others
701706
for dep, dep_mod_exists in zip(self.dependencies, mods_exist):
702-
mod_name = dep[mod_name_key]
707+
mod_name = get_module_name(dep)
703708
if dep_mod_exists:
704709
self.modules_tool.load([mod_name])
705710
dry_run_msg("module load %s" % mod_name, silent=silent)
@@ -715,15 +720,15 @@ def _load_dependencies_modules(self, silent=False):
715720
self.modules_tool.load(dep_mods)
716721

717722
if self.dependencies:
718-
build_dep_mods = [dep[mod_name_key] for dep in self.dependencies if dep['build_only']]
723+
build_dep_mods = [get_module_name(dep) for dep in self.dependencies if dep['build_only']]
719724
if build_dep_mods:
720725
trace_msg("loading modules for build dependencies:")
721726
for dep_mod in build_dep_mods:
722727
trace_msg(' * ' + dep_mod)
723728
else:
724729
trace_msg("(no build dependencies specified)")
725730

726-
run_dep_mods = [dep[mod_name_key] for dep in self.dependencies if not dep['build_only']]
731+
run_dep_mods = [get_module_name(dep) for dep in self.dependencies if not dep['build_only']]
727732
if run_dep_mods:
728733
trace_msg("loading modules for (runtime) dependencies:")
729734
for dep_mod in run_dep_mods:
@@ -784,7 +789,7 @@ def _verify_toolchain(self):
784789
self.log.debug("List of toolchain dependencies from toolchain module: %s", self.toolchain_dep_mods)
785790

786791
# only retain names of toolchain elements, excluding toolchain name
787-
toolchain_definition = {e for es in self.definition().values() for e in es if not e == self.name}
792+
toolchain_definition = {e for es in self.definition().values() for e in es if e != self.name}
788793

789794
# filter out optional toolchain elements if they're not used in the module
790795
for elem_name in toolchain_definition.copy():

0 commit comments

Comments
 (0)