summaryrefslogtreecommitdiff
path: root/src/buildstream/utils.py
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-03-10 19:00:27 +0000
committerJürg Billeter <j@bitron.ch>2020-03-10 19:00:27 +0000
commit78da6e372200a54660f102a9c7e82c260c562c95 (patch)
treeac20a036d4bb589c273a76e2b8ea92925498c71a /src/buildstream/utils.py
parent49877ff6bd1fb9ae3a18b50357e0645d70d62c7e (diff)
parenta5236efc47a65544189c63c89588821b4b813220 (diff)
downloadbuildstream-78da6e372200a54660f102a9c7e82c260c562c95.tar.gz
Merge branch 'juerg/vdirectory' into 'master'
Improve `Directory` API See merge request BuildStream/buildstream!1827
Diffstat (limited to 'src/buildstream/utils.py')
-rw-r--r--src/buildstream/utils.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/buildstream/utils.py b/src/buildstream/utils.py
index b588566df..997c073b9 100644
--- a/src/buildstream/utils.py
+++ b/src/buildstream/utils.py
@@ -1168,6 +1168,8 @@ def _tempdir(*, suffix="", prefix="tmp", dir): # pylint: disable=redefined-buil
# which is guaranteed to be named and have an entry in the filesystem.
#
# Args:
+# mode (str): The mode in which the file is opened
+# encoding (str): The name of the encoding used to decode or encode the file
# dir (str): A path to a parent directory for the temporary file
# suffix (str): A suffix for the temproary file name
# prefix (str): A prefix for the temporary file name
@@ -1180,7 +1182,7 @@ def _tempdir(*, suffix="", prefix="tmp", dir): # pylint: disable=redefined-buil
# on SIGTERM.
#
@contextmanager
-def _tempnamedfile(suffix="", prefix="tmp", dir=None): # pylint: disable=redefined-builtin
+def _tempnamedfile(mode="w+b", encoding=None, suffix="", prefix="tmp", dir=None): # pylint: disable=redefined-builtin
temp = None
def close_tempfile():
@@ -1188,7 +1190,7 @@ def _tempnamedfile(suffix="", prefix="tmp", dir=None): # pylint: disable=redefi
temp.close()
with _signals.terminator(close_tempfile), tempfile.NamedTemporaryFile(
- suffix=suffix, prefix=prefix, dir=dir
+ mode=mode, encoding=encoding, suffix=suffix, prefix=prefix, dir=dir
) as temp:
yield temp