summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandan Singh <chandan@chandansingh.net>2019-07-14 15:04:37 +0100
committerChandan Singh <chandan@chandansingh.net>2019-07-14 15:35:21 +0100
commit8f1e572f90aea0b67bf2858dac4c0c3f29461921 (patch)
tree608463162fa14a2cb7e48fe172d064296fe135a3
parentc6886c251fa3f65aa1cddb533c6121c2eb7c4ed6 (diff)
downloadbuildstream-chandan/fix-fuse-check.tar.gz
sandbox/_sandboxbwrap.py: Fix fuse import issuechandan/fix-fuse-check
This will fix an issue where BuildStream currently throws an exception when running on Linux without fuse. Fixes #1081.
-rw-r--r--src/buildstream/sandbox/_sandboxbwrap.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/buildstream/sandbox/_sandboxbwrap.py b/src/buildstream/sandbox/_sandboxbwrap.py
index 17f999ac0..1155793c6 100644
--- a/src/buildstream/sandbox/_sandboxbwrap.py
+++ b/src/buildstream/sandbox/_sandboxbwrap.py
@@ -36,7 +36,6 @@ import psutil
from .._exceptions import SandboxError
from .. import utils, _signals
-from ._mount import MountMap
from . import Sandbox, SandboxFlags
from .. import _site
@@ -147,6 +146,12 @@ class SandboxBwrap(Sandbox):
"'{}'".format(command[0]),
reason='missing-command')
+ # NOTE: MountMap transitively imports `_fuse/fuse.py` which raises an
+ # EnvironmentError when fuse is not found. Since this module is
+ # expected to be imported even in absence of fuse, MountMap is imported
+ # here, and not at the top of the module.
+ from ._mount import MountMap
+
# Create the mount map, this will tell us where
# each mount point needs to be mounted from and to
mount_map = MountMap(self, flags & SandboxFlags.ROOT_READ_ONLY)