summaryrefslogtreecommitdiff
path: root/src/buildstream/_platform
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/_platform
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/_platform')
-rw-r--r--src/buildstream/_platform/platform.py12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/buildstream/_platform/platform.py b/src/buildstream/_platform/platform.py
index dab6049ea..d6e0755f2 100644
--- a/src/buildstream/_platform/platform.py
+++ b/src/buildstream/_platform/platform.py
@@ -29,8 +29,6 @@ from .. import utils
class Platform():
- _instance = None
-
# Platform()
#
# A class to manage platform-specific details. Currently holds the
@@ -84,7 +82,7 @@ class Platform():
raise Error
@classmethod
- def _create_instance(cls):
+ def create_instance(cls):
# Meant for testing purposes and therefore hidden in the
# deepest corners of the source code. Try not to abuse this,
# please?
@@ -111,13 +109,7 @@ class Platform():
else:
raise PlatformError("No such platform: '{}'".format(backend))
- cls._instance = PlatformImpl(force_sandbox=force_sandbox)
-
- @classmethod
- def get_platform(cls):
- if not cls._instance:
- cls._create_instance()
- return cls._instance
+ return PlatformImpl(force_sandbox=force_sandbox)
def get_cpu_count(self, cap=None):
cpu_count = len(psutil.Process().cpu_affinity())