예제 #1
0
    def __init__(self, *args, **kwargs):
        """Initialize either as EasyBlock or as Extension."""

        self.is_extension = False

        if isinstance(args[0], EasyBlock):
            # make sure that extra custom easyconfig parameters are known
            extra_params = self.__class__.extra_options()
            kwargs['extra_params'] = extra_params

            Extension.__init__(self, *args, **kwargs)

            # name and version properties of EasyBlock are used, so make sure name and version are correct
            self.cfg['name'] = self.ext.get('name', None)
            self.cfg['version'] = self.ext.get('version', None)
            # We can't inherit the 'start_dir' value from the parent (which will be set, and will most likely be wrong).
            # It should be specified for the extension specifically, or be empty (so it is auto-derived).
            self.cfg['start_dir'] = self.ext.get('options',
                                                 {}).get('start_dir', None)
            self.builddir = self.master.builddir
            self.installdir = self.master.installdir
            self.modules_tool = self.master.modules_tool
            self.module_generator = self.master.module_generator
            self.is_extension = True
            self.unpack_options = None
        else:
            EasyBlock.__init__(self, *args, **kwargs)
            self.options = copy.deepcopy(self.cfg.get(
                'options', {}))  # we need this for Extension.sanity_check_step

        self.ext_dir = None  # dir where extension source was unpacked
    def __init__(self, *args, **kwargs):
        """Initialize either as EasyBlock or as Extension."""

        self.is_extension = False

        if isinstance(args[0], EasyBlock):
            # make sure that extra custom easyconfig parameters are known
            extra_params = self.__class__.extra_options()
            kwargs['extra_params'] = extra_params

            Extension.__init__(self, *args, **kwargs)

            # name and version properties of EasyBlock are used, so make sure name and version are correct
            self.cfg['name'] = self.ext.get('name', None)
            self.cfg['version'] = self.ext.get('version', None)
            # We can't inherit the 'start_dir' value from the parent (which will be set, and will most likely be wrong).
            # It should be specified for the extension specifically, or be empty (so it is auto-derived).
            self.cfg['start_dir'] = self.ext.get('options', {}).get('start_dir', None)
            self.builddir = self.master.builddir
            self.installdir = self.master.installdir
            self.modules_tool = self.master.modules_tool
            self.module_generator = self.master.module_generator
            self.is_extension = True
            self.unpack_options = None
        else:
            EasyBlock.__init__(self, *args, **kwargs)
            self.options = copy.deepcopy(self.cfg.get('options', {}))  # we need this for Extension.sanity_check_step

        self.ext_dir = None  # dir where extension source was unpacked
    def __init__(self, *args, **kwargs):
        """Initialize either as EasyBlock or as Extension."""

        self.is_extension = False

        if isinstance(args[0], EasyBlock):
            Extension.__init__(self, *args, **kwargs)
            # name and version properties of EasyBlock are used, so make sure name and version are correct
            self.cfg['name'] = self.ext.get('name', None)
            self.cfg['version'] = self.ext.get('version', None)
            self.builddir = self.master.builddir
            self.installdir = self.master.installdir
            self.modules_tool = self.master.modules_tool
            self.is_extension = True
            self.unpack_options = None

            # make sure that extra custom easyconfig parameters are known
            extra_params = self.__class__.extra_options()
            self.cfg.extend_params(extra_params, overwrite=False)
        else:
            EasyBlock.__init__(self, *args, **kwargs)
            self.options = copy.deepcopy(self.cfg.get(
                'options', {}))  # we need this for Extension.sanity_check_step

        self.ext_dir = None  # dir where extension source was unpacked
    def sanity_check_step(self, exts_filter=None, custom_paths=None, custom_commands=None):
        """
        Custom sanity check for extensions, whether installed as stand-alone module or not
        """
        if not self.cfg["exts_filter"]:
            self.cfg["exts_filter"] = exts_filter
        self.log.debug("starting sanity check for extension with filter %s", self.cfg["exts_filter"])

        if not self.is_extension:
            # load fake module
            fake_mod_data = self.load_fake_module(purge=True)

        # perform sanity check
        sanity_check_ok = Extension.sanity_check_step(self)

        if not self.is_extension:
            # unload fake module and clean up
            self.clean_up_fake_module(fake_mod_data)

        if custom_paths or self.cfg["sanity_check_paths"] or custom_commands or self.cfg["sanity_check_commands"]:
            EasyBlock.sanity_check_step(
                self, custom_paths=custom_paths, custom_commands=custom_commands, extension=self.is_extension
            )

        # pass or fail sanity check
        if not sanity_check_ok:
            msg = "Sanity check for %s failed: %s" % (self.name, "; ".join(self.sanity_check_fail_msgs))
            if self.is_extension:
                self.log.warning(msg)
            else:
                self.log.error(msg)
            return False
        else:
            self.log.info("Sanity check for %s successful!" % self.name)
            return True
    def sanity_check_step(self, exts_filter, custom_paths=None, custom_commands=None):
        """
        Custom sanity check for extensions, whether installed as stand-alone module or not
        """
        if not self.cfg["exts_filter"]:
            self.cfg["exts_filter"] = exts_filter

        if not self.is_extension:
            # load fake module
            fake_mod_data = self.load_fake_module(purge=True)

        # perform sanity check
        sanity_check_ok = Extension.sanity_check_step(self)

        if not self.is_extension:
            # unload fake module and clean up
            self.clean_up_fake_module(fake_mod_data)

        if custom_paths or custom_commands:
            EasyBlock.sanity_check_step(self, custom_paths=custom_paths, custom_commands=custom_commands)

        # pass or fail sanity check
        if not sanity_check_ok:
            if self.is_extension:
                self.log.warning("Sanity check for %s failed!" % self.name)
            else:
                self.log.error("Sanity check for %s failed!" % self.name)
            return False
        else:
            self.log.info("Sanity check for %s successful!" % self.name)
            return True
예제 #6
0
    def sanity_check_step(self, exts_filter=None, custom_paths=None, custom_commands=None):
        """
        Custom sanity check for extensions, whether installed as stand-alone module or not
        """
        if not self.cfg['exts_filter']:
            self.cfg['exts_filter'] = exts_filter
        self.log.debug("starting sanity check for extension with filter %s", self.cfg['exts_filter'])

        fake_mod_data = None
        if not (self.is_extension or self.dry_run):
            # load fake module
            fake_mod_data = self.load_fake_module(purge=True)

        # perform extension sanity check
        (sanity_check_ok, fail_msg) = Extension.sanity_check_step(self)

        if fake_mod_data:
            # unload fake module and clean up
            self.clean_up_fake_module(fake_mod_data)

        if custom_paths or custom_commands or not self.is_extension:
            super(ExtensionEasyBlock, self).sanity_check_step(custom_paths=custom_paths,
                                                              custom_commands=custom_commands,
                                                              extension=self.is_extension)

        # pass or fail sanity check
        if sanity_check_ok:
            self.log.info("Sanity check for %s successful!", self.name)
        else:
            if not self.is_extension:
                msg = "Sanity check for %s failed: %s" % (self.name, '; '.join(self.sanity_check_fail_msgs))
                raise EasyBuildError(msg)

        return (sanity_check_ok, '; '.join(self.sanity_check_fail_msgs))
    def __init__(self, *args, **kwargs):
        """Initialize either as EasyBlock or as Extension."""

        self.is_extension = False

        if isinstance(args[0], EasyBlock):
            Extension.__init__(self, *args, **kwargs)
            # name and version properties of EasyBlock are used, so make sure name and version are correct
            self.cfg["name"] = self.ext.get("name", None)
            self.cfg["version"] = self.ext.get("version", None)
            self.builddir = self.master.builddir
            self.installdir = self.master.installdir
            self.is_extension = True
        else:
            EasyBlock.__init__(self, *args, **kwargs)
            self.options = copy.deepcopy(self.cfg.get("options", {}))  # we need this for Extension.sanity_check_step

        self.ext_dir = None  # dir where extension source was unpacked
예제 #8
0
    def __init__(self, *args, **kwargs):
        """Initialize either as EasyBlock or as Extension."""

        self.is_extension = False

        if isinstance(args[0], EasyBlock):
            Extension.__init__(self, *args, **kwargs)
            # name and version properties of EasyBlock are used, so make sure name and version are correct
            self.cfg['name'] = self.ext.get('name', None)
            self.cfg['version'] = self.ext.get('version', None)
            self.builddir = self.master.builddir
            self.installdir = self.master.installdir
            self.is_extension = True
            self.unpack_options = None
        else:
            EasyBlock.__init__(self, *args, **kwargs)
            self.options = copy.deepcopy(self.cfg.get(
                'options', {}))  # we need this for Extension.sanity_check_step

        self.ext_dir = None  # dir where extension source was unpacked
예제 #9
0
    def sanity_check_step(self, exts_filter=None, custom_paths=None, custom_commands=None):
        """
        Custom sanity check for extensions, whether installed as stand-alone module or not
        """
        if not self.cfg.get_ref('exts_filter'):
            self.cfg['exts_filter'] = exts_filter
        self.log.debug("starting sanity check for extension with filter %s", self.cfg.get_ref('exts_filter'))

        # for stand-alone installations that were done for multiple dependency versions (via multi_deps),
        # we need to perform the extension sanity check for each of them, by loading the corresponding modules first
        if self.cfg['multi_deps'] and not self.is_extension:
            multi_deps = self.cfg.get_parsed_multi_deps()
            lists_of_extra_modules = [[d['short_mod_name'] for d in deps] for deps in multi_deps]
        else:
            # make sure Extension sanity check step is run once, by using a single empty list of extra modules
            lists_of_extra_modules = [[]]

        for extra_modules in lists_of_extra_modules:

            fake_mod_data = None

            # only load fake module + extra modules for stand-alone installations (not for extensions),
            # since for extension the necessary modules should already be loaded at this point
            if not (self.is_extension or self.dry_run):
                # load fake module
                fake_mod_data = self.load_fake_module(purge=True, extra_modules=extra_modules)

                if extra_modules:
                    info_msg = "Running extension sanity check with extra modules: %s" % ', '.join(extra_modules)
                    self.log.info(info_msg)
                    trace_msg(info_msg)

            # perform extension sanity check
            (sanity_check_ok, fail_msg) = Extension.sanity_check_step(self)

            if fake_mod_data:
                # unload fake module and clean up
                self.clean_up_fake_module(fake_mod_data)

        if custom_paths or custom_commands or not self.is_extension:
            super(ExtensionEasyBlock, self).sanity_check_step(custom_paths=custom_paths,
                                                              custom_commands=custom_commands,
                                                              extension=self.is_extension)

        # pass or fail sanity check
        if sanity_check_ok:
            self.log.info("Sanity check for %s successful!", self.name)
        else:
            if not self.is_extension:
                msg = "Sanity check for %s failed: %s" % (self.name, '; '.join(self.sanity_check_fail_msgs))
                raise EasyBuildError(msg)

        return (sanity_check_ok, '; '.join(self.sanity_check_fail_msgs))
    def __init__(self, *args, **kwargs):
        """Initialize either as EasyBlock or as Extension."""

        self.is_extension = False

        if isinstance(args[0], EasyBlock):
            Extension.__init__(self, *args, **kwargs)
            # name and version properties of EasyBlock are used, so make sure name and version are correct
            self.cfg['name'] = self.ext.get('name', None)
            self.cfg['version'] = self.ext.get('version', None)
            self.builddir = self.master.builddir
            self.installdir = self.master.installdir
            self.is_extension = True
            self.unpack_options = None

            # make sure that extra custom easyconfig parameters are known
            extra_params = self.__class__.extra_options()
            self.cfg.extend_params(extra_params, overwrite=False)
        else:
            EasyBlock.__init__(self, *args, **kwargs)
            self.options = copy.deepcopy(self.cfg.get('options', {}))  # we need this for Extension.sanity_check_step

        self.ext_dir = None  # dir where extension source was unpacked
예제 #11
0
    def sanity_check_step(self,
                          exts_filter=None,
                          custom_paths=None,
                          custom_commands=None):
        """
        Custom sanity check for extensions, whether installed as stand-alone module or not
        """
        if not self.cfg['exts_filter']:
            self.cfg['exts_filter'] = exts_filter
        self.log.debug("starting sanity check for extension with filter %s",
                       self.cfg['exts_filter'])

        if not self.is_extension:
            # load fake module
            fake_mod_data = self.load_fake_module(purge=True)

        # perform sanity check
        sanity_check_ok = Extension.sanity_check_step(self)

        if not self.is_extension:
            # unload fake module and clean up
            self.clean_up_fake_module(fake_mod_data)

        if custom_paths or self.cfg[
                'sanity_check_paths'] or custom_commands or self.cfg[
                    'sanity_check_commands']:
            EasyBlock.sanity_check_step(self,
                                        custom_paths=custom_paths,
                                        custom_commands=custom_commands,
                                        extension=self.is_extension)

        # pass or fail sanity check
        if not sanity_check_ok:
            msg = "Sanity check for %s failed: %s" % (self.name, '; '.join(
                self.sanity_check_fail_msgs))
            if self.is_extension:
                self.log.warning(msg)
            else:
                raise EasyBuildError(msg)
            return False
        else:
            self.log.info("Sanity check for %s successful!" % self.name)
            return True