Skip to content

Commit

Permalink
Bundle: Load easyblock only once during init.
Browse files Browse the repository at this point in the history
Signed-off-by: Jan André Reuter <[email protected]>
  • Loading branch information
Thyre committed Oct 10, 2024
1 parent 23ac32b commit 07b4490
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions easybuild/easyblocks/generic/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ def __init__(self, *args, **kwargs):
# list of EasyConfig instances for components
self.comp_cfgs = []

# list of EasyBlocks for components
self.comp_blocks = []

# list of EasyConfig instances of components for which to run sanity checks
self.comp_cfgs_sanity_check = []

Expand Down Expand Up @@ -195,6 +198,7 @@ def __init__(self, *args, **kwargs):
self.cfg.update('patches', comp_cfg['patches'])

self.comp_cfgs.append(comp_cfg)
self.comp_blocks.append(comp_cfg.easyblock(comp_cfg))

self.cfg.update('checksums', checksums_patches)

Expand Down Expand Up @@ -243,14 +247,12 @@ def build_step(self):
def install_step(self):
"""Install components, if specified."""
comp_cnt = len(self.cfg['components'])
for idx, cfg in enumerate(self.comp_cfgs):
for idx, (cfg, comp) in enumerate(zip(self.comp_cfgs, self.comp_blocks)):

print_msg("installing bundle component %s v%s (%d/%d)..." %
(cfg['name'], cfg['version'], idx + 1, comp_cnt))
self.log.info("Installing component %s v%s using easyblock %s", cfg['name'], cfg['version'], cfg.easyblock)

comp = cfg.easyblock(cfg)

# correct build/install dirs
comp.builddir = self.builddir
comp.install_subdir, comp.installdir = self.install_subdir, self.installdir
Expand Down Expand Up @@ -334,9 +336,8 @@ def make_module_req_guess(self):
"""
final_reqs = {}

for _, cfg in enumerate(self.comp_cfgs):
for cfg, comp in zip(self.comp_cfgs, self.comp_blocks):
self.log.info("Gathering module paths for component %s v%s", cfg['name'], cfg['version'])
comp = cfg.easyblock(cfg)
reqs = comp.make_module_req_guess()

if not reqs or not isinstance(reqs, dict):
Expand Down

0 comments on commit 07b4490

Please sign in to comment.