summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos Evripiotis <jevripiotis@bloomberg.net>2019-06-27 10:34:36 +0100
committerAngelos Evripiotis <angelos.evripiotis@gmail.com>2019-07-09 08:39:41 +0000
commit24e0710cdc0ad520d7f573dd3c0615e96891307c (patch)
tree36e5af90251616f80e8684f718eac89ed7105419
parentc658593f545195073017c563d44f6e1a2db1df07 (diff)
downloadbuildstream-aevri/win32_tempfilename.tar.gz
_artifact.py: use utils._tempnamedfile_nameaevri/win32_tempfilename
We are only using the filename of the temporary file here, so use the wrapper for this use-case.
-rw-r--r--src/buildstream/_artifact.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/buildstream/_artifact.py b/src/buildstream/_artifact.py
index 02adb3404..ffe92db16 100644
--- a/src/buildstream/_artifact.py
+++ b/src/buildstream/_artifact.py
@@ -29,7 +29,6 @@ artifact composite interaction away from Element class
"""
import os
-import tempfile
from ._protos.buildstream.v2.artifact_pb2 import Artifact as ArtifactProto
from . import _yaml
@@ -148,9 +147,9 @@ class Artifact():
size += filesvdir.get_size()
# Store public data
- with tempfile.NamedTemporaryFile(dir=self._tmpdir) as tmp:
- _yaml.dump(publicdata, tmp.name)
- public_data_digest = self._cas.add_object(path=tmp.name, link_directly=True)
+ with utils._tempnamedfile_name(dir=self._tmpdir) as tmpname:
+ _yaml.dump(publicdata, tmpname)
+ public_data_digest = self._cas.add_object(path=tmpname, link_directly=True)
artifact.public_data.CopyFrom(public_data_digest)
size += public_data_digest.size_bytes