Skip to content

Commit

Permalink
Allow version mismatch and include versionsuffix in modulerc
Browse files Browse the repository at this point in the history
  • Loading branch information
Micket authored and c3-builder committed Oct 28, 2023
1 parent 02e7e05 commit 1cf46f4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions easybuild/easyblocks/generic/modulerc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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'])

Expand All @@ -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)
Expand Down

0 comments on commit 1cf46f4

Please sign in to comment.