summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbst-marge-bot <marge-bot@buildstream.build>2019-08-23 17:15:54 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2019-08-23 17:15:54 +0000
commite1ca4efb05e0ba39e437f9747a6f0fe2bb50fbeb (patch)
treedf34ba18fdf87e847062552bbe72c727b58f718e
parentfcadd6b5cf3e2eee88f925e2bd4ce9726e2eebf5 (diff)
parentf150d17f07f99b48452f5ab2148b1abda2f52211 (diff)
downloadbuildstream-e1ca4efb05e0ba39e437f9747a6f0fe2bb50fbeb.tar.gz
Merge branch 'bschubert/fix-mutable-args' into 'master'
sandbox/_mounter: Remove default mutable arguments stderr/out See merge request BuildStream/buildstream!1562
-rw-r--r--src/buildstream/sandbox/_mounter.py29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/buildstream/sandbox/_mounter.py b/src/buildstream/sandbox/_mounter.py
index e6054c20d..4e31ef67a 100644
--- a/src/buildstream/sandbox/_mounter.py
+++ b/src/buildstream/sandbox/_mounter.py
@@ -28,9 +28,14 @@ from .. import utils, _signals
class Mounter():
@classmethod
def _mount(cls, dest, src=None, mount_type=None,
- stdout=sys.stdout, stderr=sys.stderr, options=None,
+ stdout=None, stderr=None, options=None,
flags=None):
+ if stdout is None:
+ stdout = sys.stdout
+ if stderr is None:
+ stderr = sys.stderr
+
argv = [utils.get_host_tool('mount')]
if mount_type:
argv.extend(['-t', mount_type])
@@ -57,7 +62,11 @@ class Mounter():
return dest
@classmethod
- def _umount(cls, path, stdout=sys.stdout, stderr=sys.stderr):
+ def _umount(cls, path, stdout=None, stderr=None):
+ if stdout is None:
+ stdout = sys.stdout
+ if stderr is None:
+ stderr = sys.stderr
cmd = [utils.get_host_tool('umount'), '-R', path]
status, _ = utils._call(
@@ -89,8 +98,12 @@ class Mounter():
#
@classmethod
@contextmanager
- def mount(cls, dest, src=None, stdout=sys.stdout,
- stderr=sys.stderr, mount_type=None, **kwargs):
+ def mount(cls, dest, src=None, stdout=None,
+ stderr=None, mount_type=None, **kwargs):
+ if stdout is None:
+ stdout = sys.stdout
+ if stderr is None:
+ stderr = sys.stderr
def kill_proc():
cls._umount(dest, stdout, stderr)
@@ -126,8 +139,12 @@ class Mounter():
#
@classmethod
@contextmanager
- def bind_mount(cls, dest, src=None, stdout=sys.stdout,
- stderr=sys.stderr, **kwargs):
+ def bind_mount(cls, dest, src=None, stdout=None,
+ stderr=None, **kwargs):
+ if stdout is None:
+ stdout = sys.stdout
+ if stderr is None:
+ stderr = sys.stderr
def kill_proc():
cls._umount(dest, stdout, stderr)