summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos Evripiotis <jevripiotis@bloomberg.net>2019-06-27 10:34:36 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-07-09 14:30:54 +0000
commita46307c561ae84443e240b5540f037f993e2a9ae (patch)
tree0f8ffbc194b6b2716a6568194d4ca4b4979d094e
parent1f9a077bb1d6877d1417870b0aad3a6a31012afb (diff)
downloadbuildstream-a46307c561ae84443e240b5540f037f993e2a9ae.tar.gz
_artifact.py: use utils._tempnamedfile_name
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