blob: 3fcf7e150c70c559e4e77c8727f69d8b383e0766 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# Some things resolved about the execution site,
# so we dont have to repeat this everywhere
#
import os
import sys
import platform
from buildstream import utils, ProgramNotFoundError
from buildstream._platform import Platform
from buildstream.testing._utils.site import HAVE_BWRAP as _HAVE_BWRAP
try:
OSTREE_CLI = utils.get_host_tool('ostree')
HAVE_OSTREE_CLI = True
except ProgramNotFoundError:
HAVE_OSTREE_CLI = False
try:
from bst_plugins_experimental.sources import _ostree # pylint: disable=unused-import
HAVE_OSTREE = True
except (ImportError, ValueError):
HAVE_OSTREE = False
try:
import arpy # pylint: disable=unused-import
HAVE_ARPY = True
except ImportError:
HAVE_ARPY = False
IS_LINUX = os.getenv('BST_FORCE_BACKEND', sys.platform).startswith('linux')
IS_WSL = (IS_LINUX and 'Microsoft' in platform.uname().release)
IS_WINDOWS = (os.name == 'nt')
if not IS_LINUX:
HAVE_SANDBOX = True # fallback to a chroot sandbox on unix
elif IS_WSL:
HAVE_SANDBOX = False # Sandboxes are inoperable under WSL due to lack of FUSE
elif IS_LINUX and _HAVE_BWRAP:
HAVE_SANDBOX = True
else:
HAVE_SANDBOX = False
MACHINE_ARCH = Platform.get_host_arch()
|