summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbst-marge-bot <marge-bot@buildstream.build>2019-10-14 09:58:30 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2019-10-14 09:58:30 +0000
commit13d9ab50e96d4a22f26ba9e4b67e7f2088b51edf (patch)
treee347779b0e3c48c3d31a7b2fffdfe6b972f5afab
parent6c6c581162ed7d87bad680330610e29d828d0f25 (diff)
parentea7c7bc8407ec6d5f65f9bf6b39dd8236185e558 (diff)
downloadbuildstream-13d9ab50e96d4a22f26ba9e4b67e7f2088b51edf.tar.gz
Merge branch 'aevri/platform_win32' into 'master'
win32: _platform/win32: add support for win32 See merge request BuildStream/buildstream!1624
-rw-r--r--src/buildstream/_platform/platform.py4
-rw-r--r--src/buildstream/_platform/win32.py59
2 files changed, 63 insertions, 0 deletions
diff --git a/src/buildstream/_platform/platform.py b/src/buildstream/_platform/platform.py
index 11c9217be..af49b9e82 100644
--- a/src/buildstream/_platform/platform.py
+++ b/src/buildstream/_platform/platform.py
@@ -98,6 +98,8 @@ class Platform():
backend = 'darwin'
elif sys.platform.startswith('linux'):
backend = 'linux'
+ elif sys.platform == 'win32':
+ backend = 'win32'
else:
backend = 'fallback'
@@ -105,6 +107,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 == 'fallback':
from .fallback import Fallback 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 000000000..36680019d
--- /dev/null
+++ b/src/buildstream/_platform/win32.py
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2019 Bloomberg Finance LP
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+from ..sandbox import SandboxDummy
+
+from .platform import Platform
+
+
+class Win32(Platform):
+
+ def maximize_open_file_limit(self):
+ # Note that on Windows, we don't have the 'resource' module to help us
+ # configure open file limits.
+ #
+ # 'psutil' provides an rlimit implementation that is only available on
+ # Linux, as of version 5.3.
+ #
+ # Given that this limit is only important for SafeHardLinks FUSE, and
+ # we don't have FUSE on Windows, this won't be an obstacle for now.
+ #
+ # If it does turn out to be an obstacle, beware that the Windows API
+ # `_setmaxstdio` for increasing the open file limit only applies to the
+ # 'stream I/O level', i.e. `fopen()` and friends. CPython opens files
+ # using `_wopen()`, which is at the 'low I/O level'.
+ #
+ # You can see this in the function `os_open_impl` in `posixmodule.c` in
+ # CPython version 3.9.
+ #
+ # For more information:
+ # https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setmaxstdio
+ #
+ pass
+
+ @staticmethod
+ def _check_dummy_sandbox_config(config):
+ return True
+
+ @staticmethod
+ def _create_dummy_sandbox(*args, **kwargs):
+ kwargs['dummy_reason'] = "There are no supported sandbox technologies for Win32 at this time."
+ return SandboxDummy(*args, **kwargs)
+
+ def _setup_dummy_sandbox(self):
+ self.check_sandbox_config = Win32._check_dummy_sandbox_config
+ self.create_sandbox = Win32._create_dummy_sandbox
+ return True