Skip to content

Commit

Permalink
replace delattr with ModuleLoadEnvironment.remove() in conda and anac…
Browse files Browse the repository at this point in the history
…onda easyblocks
  • Loading branch information
lexming committed Feb 11, 2025
1 parent 02848ea commit eee96f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 2 additions & 6 deletions easybuild/easyblocks/a/anaconda.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,8 @@ def __init__(self, *args, **kwargs):
mod_env_libs = ['LD_LIBRARY_PATH', 'LIBRARY_PATH']
mod_env_cmake = ['CMAKE_LIBRARY_PATH', 'CMAKE_PREFIX_PATH']
for disallowed_var in mod_env_headers + mod_env_libs + mod_env_cmake:
try:
delattr(self.module_load_environment, disallowed_var)
except AttributeError:
pass
else:
self.log.debug(f"Purposely not updating ${disallowed_var} in {self.name} module file")
self.module_load_environment.remove(disallowed_var)
self.log.debug(f"Purposely not updating ${disallowed_var} in {self.name} module file")

def install_step(self):
"""Copy all files in build directory to the install directory"""
Expand Down
8 changes: 2 additions & 6 deletions easybuild/easyblocks/generic/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,8 @@ def __init__(self, *args, **kwargs):
mod_env_libs = ['LD_LIBRARY_PATH', 'LIBRARY_PATH']
mod_env_cmake = ['CMAKE_LIBRARY_PATH', 'CMAKE_PREFIX_PATH']
for disallowed_var in mod_env_headers + mod_env_libs + mod_env_cmake:
try:
delattr(self.module_load_environment, disallowed_var)
except AttributeError:
pass
else:
self.log.debug(f"Purposely not updating ${disallowed_var} in {self.name} module file")
self.module_load_environment.remove(disallowed_var)
self.log.debug(f"Purposely not updating ${disallowed_var} in {self.name} module file")

def extract_step(self):
"""Copy sources via extract_step of parent, if any are specified."""
Expand Down

0 comments on commit eee96f7

Please sign in to comment.