Skip to content

Commit 0e7ab1c

Browse files
committed
replace delattr with ModuleLoadEnvironment.remove() in gcc and intelbase easyblocks
1 parent 9e5d381 commit 0e7ab1c

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

easybuild/easyblocks/g/gcc.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,9 @@ def __init__(self, *args, **kwargs):
207207
# cases where paths top libraries needed to be set explicitly
208208
# see: https://github.com/easybuilders/easybuild-easyblocks/pull/3256
209209
# Therefore, remove paths from header search paths but keep paths in LIBRARY_PATH
210-
for header_search_path in self.module_load_environment.alias_vars('HEADERS'):
211-
try:
212-
delattr(self.module_load_environment, header_search_path)
213-
except AttributeError:
214-
pass
215-
else:
216-
self.log.debug(f"Removing ${header_search_path} from module file of {self.name}")
210+
for disallowed_var in self.module_load_environment.alias_vars('HEADERS'):
211+
self.module_load_environment.remove(disallowed_var)
212+
self.log.debug(f"Purposely not updating ${disallowed_var} in {self.name} module file")
217213

218214
def create_dir(self, dirname):
219215
"""

easybuild/easyblocks/generic/intelbase.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,8 @@ def prepare_intel_tools_env(self):
140140
mod_env_headers = self.module_load_environment.alias_vars('HEADERS')
141141
mod_env_libs = ['LD_LIBRARY_PATH', 'LIBRARY_PATH']
142142
for disallowed_var in mod_env_headers + mod_env_libs:
143-
try:
144-
delattr(self.module_load_environment, disallowed_var)
145-
except AttributeError:
146-
pass
147-
else:
148-
self.log.debug(f"Purposely not updating ${disallowed_var} in {self.name} module file")
143+
self.module_load_environment.remove(disallowed_var)
144+
self.log.debug(f"Purposely not updating ${disallowed_var} in {self.name} module file")
149145

150146
def get_custom_paths_tools(self, binaries):
151147
"""Custom sanity check paths for certain Intel tools."""

0 commit comments

Comments
 (0)