Loading buildstream/_pipeline.py +2 −1 Original line number Original line Diff line number Diff line Loading @@ -146,7 +146,8 @@ class Pipeline(): load_ticker(None) load_ticker(None) # Load selected platform # Load selected platform self.platform = Platform.get_platform(context, project) Platform._create_instance(context, project) self.platform = Platform.get_platform() self.artifacts = self.platform.artifactcache self.artifacts = self.platform.artifactcache # Create the factories after resolving the project # Create the factories after resolving the project Loading buildstream/_platform/platform.py +9 −3 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,7 @@ from .. import PlatformError, ProgramNotFoundError, ImplError class Platform(): class Platform(): _instance = None # Platform() # Platform() # # Loading @@ -42,8 +43,7 @@ class Platform(): self.project = project self.project = project @classmethod @classmethod def get_platform(cls, *args, **kwargs): def _create_instance(cls, *args, **kwargs): if sys.platform.startswith('linux'): if sys.platform.startswith('linux'): backend = 'linux' backend = 'linux' else: else: Loading @@ -62,7 +62,13 @@ class Platform(): else: else: raise PlatformError("No such platform: '{}'".format(backend)) raise PlatformError("No such platform: '{}'".format(backend)) return PlatformImpl(*args, **kwargs) cls._instance = PlatformImpl(*args, **kwargs) @classmethod def get_platform(cls, *args, **kwargs): if not cls._instance: raise PlatformError("Platform needs to be initialized first") return cls._instance ################################################################## ################################################################## # Platform properties # # Platform properties # Loading Loading
buildstream/_pipeline.py +2 −1 Original line number Original line Diff line number Diff line Loading @@ -146,7 +146,8 @@ class Pipeline(): load_ticker(None) load_ticker(None) # Load selected platform # Load selected platform self.platform = Platform.get_platform(context, project) Platform._create_instance(context, project) self.platform = Platform.get_platform() self.artifacts = self.platform.artifactcache self.artifacts = self.platform.artifactcache # Create the factories after resolving the project # Create the factories after resolving the project Loading
buildstream/_platform/platform.py +9 −3 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,7 @@ from .. import PlatformError, ProgramNotFoundError, ImplError class Platform(): class Platform(): _instance = None # Platform() # Platform() # # Loading @@ -42,8 +43,7 @@ class Platform(): self.project = project self.project = project @classmethod @classmethod def get_platform(cls, *args, **kwargs): def _create_instance(cls, *args, **kwargs): if sys.platform.startswith('linux'): if sys.platform.startswith('linux'): backend = 'linux' backend = 'linux' else: else: Loading @@ -62,7 +62,13 @@ class Platform(): else: else: raise PlatformError("No such platform: '{}'".format(backend)) raise PlatformError("No such platform: '{}'".format(backend)) return PlatformImpl(*args, **kwargs) cls._instance = PlatformImpl(*args, **kwargs) @classmethod def get_platform(cls, *args, **kwargs): if not cls._instance: raise PlatformError("Platform needs to be initialized first") return cls._instance ################################################################## ################################################################## # Platform properties # # Platform properties # Loading