This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch aevri/win32
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 461c2c54637e515bff9c2ccbeffe6b5283d04ccb
Author: Angelos Evripiotis <[email protected]>
AuthorDate: Tue Apr 2 13:14:49 2019 +0100

    WIP: win32: _platform/win32: add support for win32
    
    Copy the approach of 'Darwin' and provide a SandboxDummy.
---
 src/buildstream/_platform/platform.py |  4 ++++
 src/buildstream/_platform/win32.py    | 28 ++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/src/buildstream/_platform/platform.py 
b/src/buildstream/_platform/platform.py
index dba60dd..4c147b5 100644
--- a/src/buildstream/_platform/platform.py
+++ b/src/buildstream/_platform/platform.py
@@ -47,6 +47,8 @@ class Platform():
             backend = 'linux'
         elif sys.platform.startswith('darwin'):
             backend = 'darwin'
+        elif sys.platform == 'win32':
+            backend = 'win32'
         else:
             backend = 'unix'
 
@@ -54,6 +56,8 @@ class Platform():
             from .linux import Linux as PlatformImpl  # pylint: 
disable=cyclic-import
         elif backend == 'darwin':
             from .darwin import Darwin as PlatformImpl  # pylint: 
disable=cyclic-import
+        elif backend == 'win32':
+            from .win32 import Win32 as PlatformImpl  # pylint: 
disable=cyclic-import
         elif backend == 'unix':
             from .unix import Unix as PlatformImpl  # pylint: 
disable=cyclic-import
         else:
diff --git a/src/buildstream/_platform/win32.py 
b/src/buildstream/_platform/win32.py
new file mode 100644
index 0000000..8bf639d
--- /dev/null
+++ b/src/buildstream/_platform/win32.py
@@ -0,0 +1,28 @@
+import os
+
+from .._exceptions import PlatformError
+from ..sandbox import SandboxNone
+
+from . import Platform
+
+
+class Win32(Platform):
+
+    def __init__(self):
+
+        super().__init__()
+
+    def create_sandbox(self, *args, **kwargs):
+        kwargs['dummy_reason'] = \
+            "There are no supported sandbox " + \
+            "technologies for Win32 at this time"
+        return SandboxNone(*args, **kwargs)
+
+    def check_sandbox_config(self, config):
+        # Check host os and architecture match
+        if config.build_os != self.get_host_os():
+            raise PlatformError("Configured and host OS don't match.")
+        elif config.build_arch != self.get_host_arch():
+            raise PlatformError("Configured and host architecture don't 
match.")
+
+        return True

Reply via email to