diff options
-rwxr-xr-x | scripts/tinfoil-example.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/tinfoil-example.py b/scripts/tinfoil-example.py new file mode 100755 index 00000000000..5d1a44cea73 --- /dev/null +++ b/scripts/tinfoil-example.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 + +import os +import sys + +# Set up sys.path to let us import tinfoil +scripts_path = os.path.dirname(os.path.realpath(__file__)) +lib_path = scripts_path + '/lib' +sys.path.insert(0, lib_path) +import scriptpath +scriptpath.add_bitbake_lib_path() + +import bb.tinfoil +import time + + +config_only = False + +def tf(sleep): + with bb.tinfoil.Tinfoil() as tinfoil: + tinfoil.prepare(config_only=config_only) + tmpdir = tinfoil.config_data.getVar('TMPDIR') + print('TMPDIR is "%s"' % tmpdir) + + time.sleep(sleep) + with bb.tinfoil.Tinfoil() as tinfoil: + tinfoil.prepare(config_only=config_only) + tmpdir = tinfoil.config_data.getVar('TMPDIR') + print('TMPDIR is "%s"' % tmpdir) + + +sleep = 0 +print('\n\nwith delay %s' % sleep) +tf(sleep) + +sleep = 1 +print('\n\nwith delay %s' % sleep) +tf(sleep) |