From 43568e14605d80c2837cac5c7677d4d1e82a2824 Mon Sep 17 00:00:00 2001 From: Alex Domingo Date: Wed, 5 Feb 2025 13:45:21 +0100 Subject: [PATCH] replace make_module_req_guess with module_load_environment in ansys easyblock --- easybuild/easyblocks/a/ansys.py | 52 +++++++++++++++------------------ 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/easybuild/easyblocks/a/ansys.py b/easybuild/easyblocks/a/ansys.py index 7f6a96a19a..68a982fe74 100644 --- a/easybuild/easyblocks/a/ansys.py +++ b/easybuild/easyblocks/a/ansys.py @@ -47,6 +47,29 @@ def __init__(self, *args, **kwargs): super(EB_ANSYS, self).__init__(*args, **kwargs) self.ansysver = None + # custom extra module environment entries for ANSYS + bin_dirs = [ + 'tgrid/bin', + 'Framework/bin/Linux64', + 'aisol/bin/linx64', + 'RSM/bin', + 'ansys/bin', + 'autodyn/bin', + 'CFD-Post/bin', + 'CFX/bin', + 'fluent/bin', + 'TurboGrid/bin', + 'polyflow/bin', + 'Icepak/bin', + 'icemcfd/linux64_amd/bin' + ] + if LooseVersion(self.version) >= LooseVersion('19.0'): + bin_dirs.append('CEI/bin') + # use glob pattern as we don't know exact version at this stage + # it will be expanded before injection into the module file + ansysver_glob = 'v[0-9]*' + self.module_load_environment.PATH = [os.path.join(ansysver_glob, d) for d in bin_dirs] + def install_step(self): """Custom install procedure for ANSYS.""" # Sources (e.g. iso files) may drop the execute permissions @@ -77,35 +100,6 @@ def set_ansysver(self): else: self.ansysver = 'v' + ''.join(self.version.split('.')[0:2]) - def make_module_req_guess(self): - """Custom extra module file entries for ANSYS.""" - - if self.ansysver is None: - self.set_ansysver() - - guesses = super(EB_ANSYS, self).make_module_req_guess() - dirs = [ - 'tgrid/bin', - 'Framework/bin/Linux64', - 'aisol/bin/linx64', - 'RSM/bin', - 'ansys/bin', - 'autodyn/bin', - 'CFD-Post/bin', - 'CFX/bin', - 'fluent/bin', - 'TurboGrid/bin', - 'polyflow/bin', - 'Icepak/bin', - 'icemcfd/linux64_amd/bin' - ] - if LooseVersion(self.version) >= LooseVersion('19.0'): - dirs.append('CEI/bin') - - guesses['PATH'] = [os.path.join(self.ansysver, d) for d in dirs] - - return guesses - def make_module_extra(self): """Define extra environment variables required by Ansys"""