summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-08-05 15:12:14 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-02 18:09:48 +0100
commit8f277fcf338cbbb191e4f1ccd547c52ef5f8a107 (patch)
tree0a2dfc96e60073c9aedf09761bfa2f7e8e8167e1 /bitbake/lib
parent2f33bb30c705f1870a2e1d6de73e291250ad660d (diff)
downloadpoky-8f277fcf338cbbb191e4f1ccd547c52ef5f8a107.tar.gz
bitbake: tinfoil: add context manager functions
Since calling the shutdown() function is highly recommended, make tinfoil objects a little easier to deal with by adding context manager support - so you can do the following: with bb.tinfoil.Tinfoil() as tinfoil: tinfoil.prepare(True) ... (Bitbake rev: f59bc6be2b4af1acdcf6a1b184956b5ffd297743) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/tinfoil.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py
index 95608ae3bd..441be2c615 100644
--- a/bitbake/lib/bb/tinfoil.py
+++ b/bitbake/lib/bb/tinfoil.py
@@ -59,6 +59,12 @@ class Tinfoil:
59 def register_idle_function(self, function, data): 59 def register_idle_function(self, function, data):
60 pass 60 pass
61 61
62 def __enter__(self):
63 return self
64
65 def __exit__(self, type, value, traceback):
66 self.shutdown()
67
62 def parseRecipes(self): 68 def parseRecipes(self):
63 sys.stderr.write("Parsing recipes..") 69 sys.stderr.write("Parsing recipes..")
64 self.logger.setLevel(logging.WARNING) 70 self.logger.setLevel(logging.WARNING)