Skip to content

Commit 0df35f4

Browse files
committed
Be more careful about when initial environment is altered
1 parent 941ec9c commit 0df35f4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

eb_hooks.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,11 @@ def pre_fetch_hook_zen4_gcccore1220(self, *args, **kwargs):
445445

446446

447447
def pre_module_hook_zen4_gcccore1220(self, *args, **kwargs):
448-
"""Revert changes from pre_fetch_hook_zen4_gcccore1220"""
448+
"""Make module load-able during module step"""
449449
if is_gcccore_1220_based(ecname=self.name, ecversion=self.version, tcname=self.toolchain.name,
450450
tcversion=self.toolchain.version):
451-
if hasattr(self, EESSI_MODULE_ONLY_ATTR):
452-
# Allow the module to be loaded in the module step
451+
if hasattr(self, 'initial_environ'):
452+
# Allow the module to be loaded in the module step (which uses initial environment)
453453
print_msg(f"Setting {EESSI_IGNORE_ZEN4_GCC1220_ENVVAR} in initial environment")
454454
self.initial_environ[EESSI_IGNORE_ZEN4_GCC1220_ENVVAR] = "1"
455455

@@ -473,9 +473,10 @@ def post_module_hook_zen4_gcccore1220(self, *args, **kwargs):
473473
EESSI_FORCE_ATTR)
474474

475475
# If the variable to allow loading is set, remove it
476-
if self.initial_environ.get(EESSI_IGNORE_ZEN4_GCC1220_ENVVAR, False):
477-
print_msg(f"Removing {EESSI_IGNORE_ZEN4_GCC1220_ENVVAR} in initial environment")
478-
del self.initial_environ[EESSI_IGNORE_ZEN4_GCC1220_ENVVAR]
476+
if hasattr(self, 'initial_environ'):
477+
if self.initial_environ.get(EESSI_IGNORE_ZEN4_GCC1220_ENVVAR, False):
478+
print_msg(f"Removing {EESSI_IGNORE_ZEN4_GCC1220_ENVVAR} in initial environment")
479+
del self.initial_environ[EESSI_IGNORE_ZEN4_GCC1220_ENVVAR]
479480

480481

481482
# Modules for dependencies are loaded in the prepare step. Thus, that's where we need this variable to be set

0 commit comments

Comments
 (0)