From 1cf46f443f26dfc6d08896e16bf97e3bb5da742d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20=C3=96hman?= Date: Sun, 29 Oct 2023 00:42:12 +0200 Subject: [PATCH] Allow version mismatch and include versionsuffix in modulerc --- easybuild/easyblocks/generic/modulerc.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/easybuild/easyblocks/generic/modulerc.py b/easybuild/easyblocks/generic/modulerc.py index aa67e90fe3..c6bd4b988c 100644 --- a/easybuild/easyblocks/generic/modulerc.py +++ b/easybuild/easyblocks/generic/modulerc.py @@ -30,6 +30,7 @@ import os from easybuild.framework.easyblock import EasyBlock +from easybuild.framework.easyconfig import CUSTOM from easybuild.framework.easyconfig.easyconfig import ActiveMNS from easybuild.tools.build_log import EasyBuildError, print_msg from easybuild.tools.config import install_path @@ -41,6 +42,16 @@ class ModuleRC(EasyBlock): Generic easyblock to create a software-specific .modulerc file """ + @staticmethod + def extra_options(extra_vars=None): + """Define extra easyconfig parameters specific to ModuleRC""" + if extra_vars is None: + extra_vars = {} + extra_vars.update({ + 'check_version': [True, "Check version is prefix of dependency", CUSTOM], + }) + return EasyBlock.extra_options(extra_vars) + def configure_step(self): """Do nothing.""" pass @@ -67,7 +78,8 @@ def make_module_step(self, fake=False): raise EasyBuildError("Name does not match dependency name: %s vs %s", self.name, deps[0]['name']) # ensure version to alias to is a prefix of the version of the dependency - if not deps[0]['version'].startswith(self.version) and not self.version == "default": + if self.cfg['check_version'] and \ + not deps[0]['version'].startswith(self.version) and not self.version == "default": raise EasyBuildError("Version is not 'default' and not a prefix of dependency version: %s vs %s", self.version, deps[0]['version']) @@ -85,7 +97,7 @@ def make_module_step(self, fake=False): module_version_specs = { 'modname': alias_modname, - 'sym_version': self.version, + 'sym_version': self.version + self.cfg['versionsuffix'], 'version': deps[0]['version'], } self.module_generator.modulerc(module_version=module_version_specs, filepath=modulerc)