Skip to content

Commit

Permalink
Merge pull request #4324 from branfosj/ec_info
Browse files Browse the repository at this point in the history
add `build_info_msg` easyconfig parameter
  • Loading branch information
boegel authored Aug 12, 2023
2 parents 7f602b9 + c48615e commit 76584a2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -4174,6 +4174,10 @@ def build_and_install_one(ecdict, init_env):
dry_run_msg('', silent=silent)
print_msg("processing EasyBuild easyconfig %s" % spec, log=_log, silent=silent)

if ecdict['ec']['build_info_msg']:
msg = "This easyconfig provides the following build information:\n\n%s\n"
print_msg(msg % ecdict['ec']['build_info_msg'], log=_log, silent=silent)

if dry_run:
# print note on interpreting dry run output (argument is reference to location of dry run messages)
print_dry_run_note('below', silent=silent)
Expand Down
2 changes: 2 additions & 0 deletions easybuild/framework/easyconfig/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@
'buildstats': [None, "A list of dicts with build statistics", OTHER],
'deprecated': [False, "String specifying reason why this easyconfig file is deprecated "
"and will be archived in the next major release of EasyBuild", OTHER],
'build_info_msg': [None, "String with information to be printed to stdout and logged during the building "
"of the easyconfig", OTHER],
}


Expand Down
24 changes: 24 additions & 0 deletions test/framework/toy_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3900,6 +3900,30 @@ def test_toy_post_install_messages(self):
regex = re.compile(pattern, re.M)
self.assertTrue(regex.search(stdout), "Pattern '%s' should be found in: %s" % (regex.pattern, stdout))

def test_toy_build_info_msg(self):
"""
Test use of build info message
"""
test_ecs = os.path.join(os.path.dirname(__file__), 'easyconfigs', 'test_ecs')
toy_ec = os.path.join(test_ecs, 't', 'toy', 'toy-0.0.eb')

test_ec_txt = read_file(toy_ec)
test_ec_txt += '\nbuild_info_msg = "Are you sure you want to install this toy software?"'
test_ec = os.path.join(self.test_prefix, 'test.eb')
write_file(test_ec, test_ec_txt)

with self.mocked_stdout_stderr():
self.test_toy_build(ec_file=test_ec, testing=False, verify=False, raise_error=True)
stdout = self.get_stdout()

pattern = '\n'.join([
r"== This easyconfig provides the following build information:",
r'',
r"Are you sure you want to install this toy software\?",
])
regex = re.compile(pattern, re.M)
self.assertTrue(regex.search(stdout), "Pattern '%s' should be found in: %s" % (regex.pattern, stdout))


def suite():
""" return all the tests in this file """
Expand Down

0 comments on commit 76584a2

Please sign in to comment.