From f3a1f35b5acf46d241ed3f3262e86ae6ed054771 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Wed, 20 Sep 2023 17:34:32 +0200 Subject: [PATCH] fix failing build for testthat R extension on top of recent glibc via pre_single_extension hook that replaces SIGSTKSZ with constant value --- eb_hooks.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/eb_hooks.py b/eb_hooks.py index 488e53d929..95092fbdc2 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -274,6 +274,22 @@ def pre_test_hook_ignore_failing_tests_SciPybundle(self, *args, **kwargs): self.cfg['testopts'] = "|| echo ignoring failing tests" +def pre_single_extension_hook(ext, *args, **kwargs): + """Main pre-configure hook: trigger custom functions based on software name.""" + if ext.name in PRE_SINGLE_EXTENSION_HOOKS: + PRE_SINGLE_EXTENSION_HOOKS[ext.name](ext, *args, **kwargs) + + +def pre_single_extension_testthat(ext, *args, **kwargs): + """ + Pre-extension hook for testthat, to fix build on top of recent glibc. + """ + if ext.name == 'testthat' and LooseVersion(ext.version) < LooseVersion('3.1.0'): + # use constant value instead of SIGSTKSZ for stack size, + # cfr. https://github.com/r-lib/testthat/issues/1373 + https://github.com/r-lib/testthat/pull/1403 + ext.cfg['preinstallopts'] = "sed -i 's/SIGSTKSZ/32768/g' inst/include/testthat/vendor/catch.h && " + + PARSE_HOOKS = { 'CGAL': parse_hook_cgal_toolchainopts_precise, 'fontconfig': parse_hook_fontconfig_add_fonts, @@ -296,3 +312,7 @@ def pre_test_hook_ignore_failing_tests_SciPybundle(self, *args, **kwargs): PRE_TEST_HOOKS = { 'SciPy-bundle': pre_test_hook_ignore_failing_tests_SciPybundle, } + +PRE_SINGLE_EXTENSION_HOOKS = { + 'testthat': pre_single_extension_testthat, +}