Skip to content

Commit b82c28c

Browse files
authored
Merge pull request #267 from branfosj/develop
example of adding a hook conditional on EasyBuild version
2 parents 7cf74ef + e743a91 commit b82c28c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/hooks.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,3 +357,16 @@ def post_run_shell_cmd_hook(cmd, work_dir=None, interactive=None, exit_code=None
357357
cmd_type = 'interactive' if interactive else 'non-interactive'
358358
fp.write("%s command '%s' in %s exited with %s - output: %s\n" % (cmd_type, cmd, work_dir, exit_code, output))
359359
```
360+
361+
### Adding a hook conditional on EasyBuild version
362+
363+
If an unknown hook is used then EasyBuild will error (see [Available hooks](#available-hooks)). The following example only
364+
adds the `pre_build_and_install_loop_hook` if the EasyBuild version is `>= "4.8.1"`.
365+
366+
```py
367+
from easybuild.tools.version import VERSION
368+
369+
if VERSION >= "4.8.1":
370+
def pre_build_and_install_loop_hook(ecs, *args, **kwargs):
371+
pass
372+
```

0 commit comments

Comments
 (0)