summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2018-10-24 10:50:01 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2018-10-25 15:43:52 +0100
commit7c72d25bff179ba2b37c2fe9c0a9a5eef43345b6 (patch)
tree030a3041145291e720a4bf9207f7e6f62661fbb7
parentf1cfc0b781973bb0455181e6a869cbfcdc92e456 (diff)
downloadbuildstream-7c72d25bff179ba2b37c2fe9c0a9a5eef43345b6.tar.gz
sandbox/_mount.py: Do not use dict literals in argument defaults
The use of dictionary literals in argument defaults is disrecommended due to the way that they are static and thus potentially very confusing. Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
-rw-r--r--buildstream/sandbox/_mount.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/buildstream/sandbox/_mount.py b/buildstream/sandbox/_mount.py
index 2dc3df2b5..aff9e8a2d 100644
--- a/buildstream/sandbox/_mount.py
+++ b/buildstream/sandbox/_mount.py
@@ -30,7 +30,7 @@ from .._fuse import SafeHardlinks
# Helper data object representing a single mount point in the mount map
#
class Mount():
- def __init__(self, sandbox, mount_point, safe_hardlinks, fuse_mount_options={}):
+ def __init__(self, sandbox, mount_point, safe_hardlinks, fuse_mount_options=None):
scratch_directory = sandbox._get_scratch_directory()
# Getting _get_underlying_directory() here is acceptable as
# we're part of the sandbox code. This will fail if our
@@ -39,7 +39,7 @@ class Mount():
self.mount_point = mount_point
self.safe_hardlinks = safe_hardlinks
- self._fuse_mount_options = fuse_mount_options
+ self._fuse_mount_options = {} if fuse_mount_options is None else fuse_mount_options
# FIXME: When the criteria for mounting something and its parent
# mount is identical, then there is no need to mount an additional
@@ -101,10 +101,13 @@ class Mount():
#
class MountMap():
- def __init__(self, sandbox, root_readonly, fuse_mount_options={}):
+ def __init__(self, sandbox, root_readonly, fuse_mount_options=None):
# We will be doing the mounts in the order in which they were declared.
self.mounts = OrderedDict()
+ if fuse_mount_options is None:
+ fuse_mount_options = {}
+
# We want safe hardlinks on rootfs whenever root is not readonly
self.mounts['/'] = Mount(sandbox, '/', not root_readonly, fuse_mount_options)