11 """This file contains multiple utility functions which can be used by
12 validation steering files. """
21 """Update the environment with b2setup
23 This is very annoying as there is no way for sub processes to modify the
24 parent environment. And also b2setup ist not inherited by sub shells. So we
25 have to run bash, source the tools, run b2setup and get all the environment
26 variables from the output.
31 "BELLE2_NO_TOOLS_CHECK=1 source {}/b2setup > /dev/null && "
32 '{} -c "import sys,os,pickle; '
33 'sys.stdout.buffer.write(pickle.dumps(dict(os.environ)))"'.format(
34 os.environ[
"BELLE2_TOOLS"], sys.executable
37 output = subprocess.check_output([
"bash",
"-c", cmd])
38 newenv = pickle.loads(output)
39 os.environ.update(newenv)