summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-07-09 15:30:40 +0200
committerJürg Billeter <j@bitron.ch>2019-07-16 13:35:01 +0200
commitfb1b3537ad6aa3d67d97bbcc1c87b5607b112003 (patch)
tree32091f737c4fd8406b550c1dd322207be98ed87d
parent6163ef87e0ab871efe44630aac00487fcfa06c65 (diff)
downloadbuildstream-fb1b3537ad6aa3d67d97bbcc1c87b5607b112003.tar.gz
_context.py: Make Context class a Python context manager
This will allow reliable cleanup.
-rw-r--r--src/buildstream/_context.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/buildstream/_context.py b/src/buildstream/_context.py
index 286ed6d3d..1e45d776d 100644
--- a/src/buildstream/_context.py
+++ b/src/buildstream/_context.py
@@ -164,6 +164,20 @@ class Context():
self._cascache = None
self._casquota = None
+ # __enter__()
+ #
+ # Called when entering the with-statement context.
+ #
+ def __enter__(self):
+ return self
+
+ # __exit__()
+ #
+ # Called when exiting the with-statement context.
+ #
+ def __exit__(self, exc_type, exc_value, traceback):
+ return None
+
# load()
#
# Loads the configuration files