mirror of
https://git.yoctoproject.org/poky
synced 2026-05-09 17:39:31 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
2f33bb30c7
commit
8f277fcf33
@@ -59,6 +59,12 @@ class Tinfoil:
|
|||||||
def register_idle_function(self, function, data):
|
def register_idle_function(self, function, data):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, type, value, traceback):
|
||||||
|
self.shutdown()
|
||||||
|
|
||||||
def parseRecipes(self):
|
def parseRecipes(self):
|
||||||
sys.stderr.write("Parsing recipes..")
|
sys.stderr.write("Parsing recipes..")
|
||||||
self.logger.setLevel(logging.WARNING)
|
self.logger.setLevel(logging.WARNING)
|
||||||
|
|||||||
Reference in New Issue
Block a user