Skip to content

Commit

Permalink
Init extensions before loading (fake) module
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
Flamefire committed Sep 23, 2024
1 parent 5aa8f9b commit ab6c5d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand All @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion test/framework/toy_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down

0 comments on commit ab6c5d8

Please sign in to comment.