Skip to content

Commit

Permalink
Merge pull request #4678 from Flamefire/dry-run-multi-deps
Browse files Browse the repository at this point in the history
fix dry-run output when using `multi_deps`
  • Loading branch information
boegel authored Dec 11, 2024
2 parents a0f8b99 + 56da654 commit dcbd5c9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
26 changes: 14 additions & 12 deletions easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -3072,21 +3072,24 @@ def post_install_step(self):
# create *relative* 'lib' symlink to 'lib64';
symlink('lib64', lib_dir, use_abspath_source=False)

def _dispatch_sanity_check_step(self, *args, **kwargs):
"""Decide whether to run the dry-run or the real version of the sanity-check step"""
if self.dry_run:
self._sanity_check_step_dry_run(*args, **kwargs)
else:
self._sanity_check_step(*args, **kwargs)

def sanity_check_step(self, *args, **kwargs):
"""
Do a sanity check on the installation
- if *any* of the files/subdirectories in the installation directory listed
in sanity_check_paths are non-existent (or empty), the sanity check fails
"""
if self.dry_run:
self._sanity_check_step_dry_run(*args, **kwargs)

# handling of extensions that were installed for multiple dependency versions is done in ExtensionEasyBlock
elif self.cfg['multi_deps'] and not self.is_extension:
if self.cfg['multi_deps'] and not self.is_extension:
self._sanity_check_step_multi_deps(*args, **kwargs)

else:
self._sanity_check_step(*args, **kwargs)
self._dispatch_sanity_check_step(*args, **kwargs)

def _sanity_check_step_multi_deps(self, *args, **kwargs):
"""Perform sanity check for installations that iterate over a list a versions for particular dependencies."""
Expand Down Expand Up @@ -3118,7 +3121,7 @@ def _sanity_check_step_multi_deps(self, *args, **kwargs):
self.log.info(info_msg)

kwargs['extra_modules'] = extra_modules
self._sanity_check_step(*args, **kwargs)
self._dispatch_sanity_check_step(*args, **kwargs)

# restore list of lists of build dependencies & stop iterating again
self.cfg['builddependencies'] = builddeps
Expand Down Expand Up @@ -3379,14 +3382,13 @@ def _sanity_check_step_common(self, custom_paths, custom_commands):
# if enhance_sanity_check is enabled *and* sanity_check_paths are specified in the easyconfig,
# those paths are used to enhance the paths provided by the easyblock
if enhance_sanity_check and ec_paths:
for key in ec_paths:
val = ec_paths[key]
for key, val in ec_paths.items():
if isinstance(val, list):
paths[key] = paths.get(key, []) + val
else:
error_pattern = "Incorrect value type in sanity_check_paths, should be a list: "
error_pattern += "%s (type: %s)" % (val, type(val))
raise EasyBuildError(error_pattern)
error_msg = "Incorrect value type in sanity_check_paths, should be a list: "
error_msg += "%s (type: %s)" % (val, type(val))
raise EasyBuildError(error_msg)
self.log.info("Enhanced sanity check paths after taking into account easyconfig file: %s", paths)

sorted_keys = sorted(paths.keys())
Expand Down
6 changes: 2 additions & 4 deletions easybuild/tools/include.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,8 @@ def include_easyblocks(tmpdir, paths):

# hard inject location to included (generic) easyblocks into Python search path
# only prepending to sys.path is not enough due to 'pkgutil.extend_path' in easybuild/easyblocks/__init__.py
new_path = os.path.join(easyblocks_path, 'easybuild', 'easyblocks')
easybuild.easyblocks.__path__.insert(0, new_path)
new_path = os.path.join(new_path, 'generic')
easybuild.easyblocks.generic.__path__.insert(0, new_path)
easybuild.easyblocks.__path__.insert(0, easyblocks_dir)
easybuild.easyblocks.generic.__path__.insert(0, os.path.join(easyblocks_dir, 'generic'))

# sanity check: verify that included easyblocks can be imported (from expected location)
for subdir, ebs in [('', included_ebs), ('generic', included_generic_ebs)]:
Expand Down

0 comments on commit dcbd5c9

Please sign in to comment.