summaryrefslogtreecommitdiff
path: root/src/buildstream/_context.py
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-07-16 15:51:39 +0200
committerbst-marge-bot <marge-bot@buildstream.build>2019-07-17 10:42:53 +0000
commitdf92e8e08ea4ddfd58d6cfbf63d758cda5d3d44f (patch)
tree18552a6b837d8df1a4ec01a2d043d0a64634890f /src/buildstream/_context.py
parent6160a64cfc4788d9c7e0519b77f55ed870b6a6a7 (diff)
downloadbuildstream-df92e8e08ea4ddfd58d6cfbf63d758cda5d3d44f.tar.gz
Store Platform reference in Context instance variable
This allows us to remove the platform reset helpers in tests/conftest.py.
Diffstat (limited to 'src/buildstream/_context.py')
-rw-r--r--src/buildstream/_context.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/buildstream/_context.py b/src/buildstream/_context.py
index bb9825f44..3c20834b0 100644
--- a/src/buildstream/_context.py
+++ b/src/buildstream/_context.py
@@ -25,6 +25,7 @@ from . import _yaml
from ._exceptions import LoadError, LoadErrorReason
from ._messenger import Messenger
from ._profile import Topics, PROFILER
+from ._platform import Platform
from ._artifactcache import ArtifactCache
from ._sourcecache import SourceCache
from ._cas import CASCache, CASQuota, CASCacheUsage
@@ -153,6 +154,7 @@ class Context():
self.messenger = Messenger()
# Private variables
+ self._platform = None
self._artifactcache = None
self._sourcecache = None
self._projects = []
@@ -343,6 +345,13 @@ class Context():
'remote-execution'])
@property
+ def platform(self):
+ if not self._platform:
+ self._platform = Platform.create_instance()
+
+ return self._platform
+
+ @property
def artifactcache(self):
if not self._artifactcache:
self._artifactcache = ArtifactCache(self)