diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2018-10-24 10:50:01 +0100 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2018-10-25 13:58:09 +0100 |
commit | aa650bb2793d4594f97eaff26f09bfaf0903812c (patch) | |
tree | 76620788747c58ba59c671c502f82ac070901c9e | |
parent | 6b9d9e5f3fc2c41757b77619a5824f5b86d7d039 (diff) | |
download | buildstream-aa650bb2793d4594f97eaff26f09bfaf0903812c.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.py | 9 |
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) |