added regex to fix WM_PROJECT_VERSION correctly#1489
added regex to fix WM_PROJECT_VERSION correctly#1489boegel merged 5 commits intoeasybuilders:developfrom
Conversation
| self.log.debug("Patching out hardcoded $WM_* env vars in %s", script) | ||
| # disable any third party stuff, we use EB controlled builds | ||
| regex_subs = [(r"^(setenv|export) WM_THIRD_PARTY_USE_.*[ =].*$", r"# \g<0>")] | ||
| regex_subs += [(r"^(setenv|export) WM_PROJECT_VERSION=.*$", r"export WM_PROJECT_VERSION=%s #\g<0>" % self.version)] |
There was a problem hiding this comment.
line too long (127 > 120 characters)
|
|
||
| # replacement dictionary of key-values | ||
| replacement_dict = {"WM_PROJECT_VERSION": self.version} | ||
| for key,val in replacement_dict.items(): |
|
@mboisson move the PR to develop instead of master please. |
|
@akesandgren You can change the target branch (as maintainer or PR author) via the |
|
@mboisson This looks good to me, but it will need to be tested thoroughly on all existing |
|
oops, my bad for master instead of develop @akesandgren |
|
@mboisson One problematic case is an old version of OpenFOAM-Extend: You can dance around this and not touch |
|
Ok, added a test case for OpenFOAM Extend < 2.0 |
| # replacement dictionary of key-values | ||
| replacement_dict = {"WM_PROJECT_VERSION": self.version} | ||
| for key, val in replacement_dict.items(): | ||
| regex_subs += [(r"^(setenv|export) %s=.*$" % key, r"export %s=%s #\g<0>" % (key, val))] |
There was a problem hiding this comment.
@mboisson Since replacement_dict only has a single entry, this can be collapsed to:
if 'extend' not in self.name.lower() or LooseVersion(self.version) >= LooseVersion('2.0'):
key = 'WM_PROJECT_VERSION'
regex_subs.append((r"^(setenv|export) %s=.*$" % key, r"export %s=%s #\g<0>" % (key, self.version)))There was a problem hiding this comment.
If this makes the line too long, split it on the .:
regex_subs.append((r"^(setenv|export) %s=.*$" % key,
r"export %s=%s #\g<0>" % (key, self.version)))|
Tested with existing |
This fixes WM_PROJECT_VERSION in OpenFOAM's bashrc files to use whatever is used by the easyconfig. It allows to use custom version numbers since OpenFOAM is so bad at versioning their software. .