diff --git a/easybuild/framework/easyblock.py b/easybuild/framework/easyblock.py index df1866b6db..9761ff7fab 100644 --- a/easybuild/framework/easyblock.py +++ b/easybuild/framework/easyblock.py @@ -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.""" @@ -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 @@ -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()) diff --git a/easybuild/tools/include.py b/easybuild/tools/include.py index 0171d74f10..6c76d9715c 100644 --- a/easybuild/tools/include.py +++ b/easybuild/tools/include.py @@ -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)]: