Skip to content

Commit

Permalink
replace Catch2 build dep in pybind11 via parse hook
Browse files Browse the repository at this point in the history
  • Loading branch information
boegel committed Nov 22, 2023
1 parent ed4babe commit 32213e0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ easyconfigs:
options:
from-pr: 19264
- foss-2023a.eb
- SciPy-bundle-2023.07-gfbf-2023a.eb
- pybind11-2.11.1-GCCcore-12.3.0.eb:
options:
from-pr: 19270
- SciPy-bundle-2023.07-gfbf-2023a.eb
- TensorFlow-2.13.0-foss-2023a.eb:
options:
from-pr: 19268
23 changes: 23 additions & 0 deletions eb_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import re

from easybuild.easyblocks.generic.configuremake import obtain_config_guess
from easybuild.framework.easyconfig.constants import EASYCONFIG_CONSTANTS
from easybuild.tools.build_log import EasyBuildError, print_msg
from easybuild.tools.config import build_option, update_build_option
from easybuild.tools.filetools import apply_regex_substitutions, copy_file, which
Expand All @@ -22,6 +23,8 @@

EESSI_RPATH_OVERRIDE_ATTR = 'orig_rpath_override_dirs'

SYSTEM = EASYCONFIG_CONSTANTS['SYSTEM'][0]


def get_eessi_envvar(eessi_envvar):
"""Get an EESSI environment variable from the environment"""
Expand Down Expand Up @@ -180,6 +183,25 @@ def parse_hook_openblas_relax_lapack_tests_num_errors(ec, eprefix):
raise EasyBuildError("OpenBLAS-specific hook triggered for non-OpenBLAS easyconfig?!")


def parse_hook_pybind11_replace_catch2(ec, eprefix):
"""
Replace Catch2 build dependency in pybind11 easyconfigs with one that doesn't use system toolchain.
cfr. https://github.com/easybuilders/easybuild-easyconfigs/pull/19270
"""
# tihs is mainly necessary to avoid that --missing keeps reporting Catch2/2.13.9 is missing,
# and to avoid that we need to use "--from-pr 19270" for every easyconfigs that (indirectly) depends on pybind11
if ec.name == 'pybind11' and ec.version in ['2.10.3', '2.11.1']:
build_deps = ec['builddependencies']
catch2_build_dep = None
catch2_name, catch2_version = ('Catch2', '2.13.9')
for idx, build_dep in enumerate(build_deps):
if build_dep[0] == catch2_name and build_dep[1] == catch2_version:
catch2_build_dep = build_dep
break
if catch2_build_dep and len(catch2_build_dep) == 4 and catch2_build_dep[3] == SYSTEM:
build_deps[idx] = (catch2_name, catch2_version)


def parse_hook_qt5_check_qtwebengine_disable(ec, eprefix):
"""
Disable check for QtWebEngine in Qt5 as workaround for problem with determining glibc version.
Expand Down Expand Up @@ -341,6 +363,7 @@ def pre_single_extension_isoband(ext, *args, **kwargs):
'CGAL': parse_hook_cgal_toolchainopts_precise,
'fontconfig': parse_hook_fontconfig_add_fonts,
'OpenBLAS': parse_hook_openblas_relax_lapack_tests_num_errors,
'pybind11': parse_hook_pybind11_replace_catch2,
'Qt5': parse_hook_qt5_check_qtwebengine_disable,
'UCX': parse_hook_ucx_eprefix,
}
Expand Down

0 comments on commit 32213e0

Please sign in to comment.