summaryrefslogtreecommitdiff
path: root/buildstream/_platform
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2018-09-26 10:08:25 +0100
committerJürg Billeter <j@bitron.ch>2018-09-27 10:19:12 +0100
commitdd770ec37e068aa0725a7696612d600d3c30277f (patch)
tree51584aa100e54ca257e831451a90dd01ce0dc4b2 /buildstream/_platform
parent0d0f700db3113026e7f0ef2c233f6935a22b5f09 (diff)
downloadbuildstream-dd770ec37e068aa0725a7696612d600d3c30277f.tar.gz
Use lazy platform instantiation
Now that the platform is independent of the context, explicit instantiation is no longer required. This avoids issues with platform instances used across test cases with mismatching context.
Diffstat (limited to 'buildstream/_platform')
-rw-r--r--buildstream/_platform/platform.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/buildstream/_platform/platform.py b/buildstream/_platform/platform.py
index bbd2e65ab..b37964986 100644
--- a/buildstream/_platform/platform.py
+++ b/buildstream/_platform/platform.py
@@ -35,7 +35,7 @@ class Platform():
pass
@classmethod
- def create_instance(cls, *args, **kwargs):
+ def _create_instance(cls):
if sys.platform.startswith('linux'):
backend = 'linux'
else:
@@ -54,12 +54,12 @@ class Platform():
else:
raise PlatformError("No such platform: '{}'".format(backend))
- cls._instance = PlatformImpl(*args, **kwargs)
+ cls._instance = PlatformImpl()
@classmethod
def get_platform(cls):
if not cls._instance:
- raise PlatformError("Platform needs to be initialized first")
+ cls._create_instance()
return cls._instance
##################################################################