diff options
author | Jürg Billeter <j@bitron.ch> | 2019-07-09 15:30:40 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-07-16 13:35:01 +0200 |
commit | fb1b3537ad6aa3d67d97bbcc1c87b5607b112003 (patch) | |
tree | 32091f737c4fd8406b550c1dd322207be98ed87d | |
parent | 6163ef87e0ab871efe44630aac00487fcfa06c65 (diff) | |
download | buildstream-fb1b3537ad6aa3d67d97bbcc1c87b5607b112003.tar.gz |
_context.py: Make Context class a Python context manager
This will allow reliable cleanup.
-rw-r--r-- | src/buildstream/_context.py | 14 |
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 |