Skip to content

Commit a6c8c1c

Browse files
author
Richard Top
committed
replaced the hook with a pre_configure_hook
1 parent d5e1b1a commit a6c8c1c

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

eb_hooks.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -409,26 +409,6 @@ def parse_hook_cgal_toolchainopts_precise(ec, eprefix):
409409
raise EasyBuildError("CGAL-specific hook triggered for non-CGAL easyconfig?!")
410410

411411

412-
def parse_hook_grass(ec, *args, **kwargs):
413-
"""
414-
Parse hook to remove filtered deps specific configopts lines for readline, zlib, and bzlib
415-
"""
416-
if ec.name == 'GRASS':
417-
# Configuration options to remove
418-
options_to_remove = [
419-
'--with-readline-libs=$EBROOTLIBREADLINE/lib --with-readline-includes=$EBROOTLIBREADLINE/include ',
420-
'--with-zlib-libs=$EBROOTZLIB/lib --with-zlib-includes=$EBROOTZLIB/include ',
421-
'--with-bzlib --with-bzlib-libs=$EBROOTBZIP2/lib --with-bzlib-includes=$EBROOTBZIP2/include '
422-
]
423-
current_configopts = ec.get('configopts', '')
424-
for option in options_to_remove:
425-
current_configopts = current_configopts.replace(option, '')
426-
ec['configopts'] = current_configopts.strip()
427-
print_msg("Using custom configure options for %s", ec.name)
428-
else:
429-
raise EasyBuildError("GRASS-specific hook triggered for non-GRASS easyconfig?!")
430-
431-
432412
def parse_hook_fontconfig_add_fonts(ec, eprefix):
433413
"""Inject --with-add-fonts configure option for fontconfig."""
434414
if ec.name == 'fontconfig':
@@ -804,6 +784,24 @@ def pre_configure_hook_CUDA_Samples_test_remove(self, *args, **kwargs):
804784
raise EasyBuildError("CUDA-Samples-specific hook triggered for non-CUDA-Samples easyconfig?!")
805785

806786

787+
def pre_configure_hook_grass(self, *args, **kwargs):
788+
"""
789+
Pre-configure hook for GRASS to remove filtered deps specific configopts lines for readline, zlib, and bzlib
790+
"""
791+
if self.name == 'GRASS':
792+
# determine path to Prefix installation in compat layer via $EPREFIX
793+
eprefix = get_eessi_envvar('EPREFIX')
794+
795+
# Dependencies for which the configuration options need to be replaced
796+
filtered_deps = ['readline', 'zlib', 'bzlib']
797+
for dep in filtered_deps:
798+
self.cfg['configopts'] = re.sub(fr'--with-{dep}-includes=\S*', f'--with-{dep}-includes=$EPREFIX/usr/include', self.cfg['configopts'])
799+
self.cfg['configopts'] = re.sub(fr'--with-{dep}-libs=\S*', f'--with-{dep}-libs=$EPREFIX/usr/lib64', self.cfg['configopts'])
800+
print_msg("Using custom configure options for %s", self.name)
801+
else:
802+
raise EasyBuildError("GRASS-specific hook triggered for non-GRASS easyconfig?!")
803+
804+
807805
def pre_configure_hook_score_p(self, *args, **kwargs):
808806
"""
809807
Pre-configure hook for Score-p
@@ -1599,7 +1597,6 @@ def post_easyblock_hook(self, *args, **kwargs):
15991597
PARSE_HOOKS = {
16001598
'casacore': parse_hook_casacore_disable_vectorize,
16011599
'CGAL': parse_hook_cgal_toolchainopts_precise,
1602-
'GRASS': parse_hook_grass,
16031600
'fontconfig': parse_hook_fontconfig_add_fonts,
16041601
'FreeImage': parse_hook_freeimage_aarch64,
16051602
'grpcio': parse_hook_grpcio_zlib,
@@ -1625,6 +1622,7 @@ def post_easyblock_hook(self, *args, **kwargs):
16251622
'CUDA-Samples': pre_configure_hook_CUDA_Samples_test_remove,
16261623
'GObject-Introspection': pre_configure_hook_gobject_introspection,
16271624
'Extrae': pre_configure_hook_extrae,
1625+
'GRASS': pre_configure_hook_grass,
16281626
'GROMACS': pre_configure_hook_gromacs,
16291627
'libfabric': pre_configure_hook_libfabric_disable_psm3_x86_64_generic,
16301628
'LLVM': pre_configure_hook_llvm,

0 commit comments

Comments
 (0)