From ab6c5d8310b05f3cec2ef601e77d93fead3f0ce9 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Mon, 23 Sep 2024 13:26:46 +0200 Subject: [PATCH] Init extensions before loading (fake) module The extensions are required by the module creation and will be loaded if they are not yet. In `extensions_step` they would then be loaded again. Avoid this by doing this earlier in `extensions_step` --- easybuild/framework/easyblock.py | 16 +++++++--------- test/framework/toy_build.py | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/easybuild/framework/easyblock.py b/easybuild/framework/easyblock.py index c44f3b99b6..2011a03d30 100644 --- a/easybuild/framework/easyblock.py +++ b/easybuild/framework/easyblock.py @@ -2887,6 +2887,13 @@ def extensions_step(self, fetch=False, install=True): self.log.debug("No extensions in exts_list") return + self.prepare_for_extensions() + + # we really need a default class + if not self.cfg['exts_defaultclass']: + raise EasyBuildError("ERROR: No default extension class set for %s", self.name) + self.init_ext_instances() + # load fake module fake_mod_data = None if install and not self.dry_run: @@ -2898,8 +2905,6 @@ def extensions_step(self, fetch=False, install=True): start_progress_bar(PROGRESS_BAR_EXTENSIONS, len(self.cfg['exts_list'])) - self.prepare_for_extensions() - if fetch: self.update_exts_progress_bar("fetching extension sources/patches") self.exts = self.collect_exts_file_info(fetch_files=True) @@ -2910,13 +2915,6 @@ def extensions_step(self, fetch=False, install=True): if install: self.log.info("Installing extensions") - # we really need a default class - if not self.cfg['exts_defaultclass'] and fake_mod_data: - self.clean_up_fake_module(fake_mod_data) - raise EasyBuildError("ERROR: No default extension class set for %s", self.name) - - self.init_ext_instances() - if self.skip: self.skip_extensions() diff --git a/test/framework/toy_build.py b/test/framework/toy_build.py index 2aa4d9bcaf..c0318e1a27 100644 --- a/test/framework/toy_build.py +++ b/test/framework/toy_build.py @@ -3033,13 +3033,13 @@ def post_run_shell_cmd_hook(cmd, *args, **kwargs): ' gcc toy.c -o toy && copy_toy_file toy copy_of_toy' command failed (exit code 127), but I fixed it! in post-install hook for toy v0.0 bin, lib - in module-write hook hook for {mod_name} toy 0.0 ['%(name)s-%(version)s.tar.gz'] echo toy toy 0.0 ['%(name)s-%(version)s.tar.gz'] echo toy + in module-write hook hook for {mod_name} installing of extension bar is done! pre_run_shell_cmd_hook triggered for ' gcc toy.c -o toy ' ' gcc toy.c -o toy && copy_toy_file toy copy_of_toy' command failed (exit code 127), but I fixed it!