Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix dry-run output when using multi_deps #4678

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -3066,21 +3066,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 @@ -3112,7 +3115,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 @@ -3373,14 +3376,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
Loading