summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <ben.c.schubert@gmail.com>2019-06-28 17:06:43 +0100
committerBenjamin Schubert <ben.c.schubert@gmail.com>2019-07-09 16:55:54 +0100
commita0280c735f4d82619da69e944d1aacd383f2ef0e (patch)
tree9bc6f9c569ab7082b9b5f584b7544f964e54f4a9
parent665598e9d456df085c6b0711e2fbabe172df3481 (diff)
downloadbuildstream-a0280c735f4d82619da69e944d1aacd383f2ef0e.tar.gz
_yaml: Decomission 'dump()'. 'roundtrip_dump' is an equivalent function now
Remove completely '_yaml.dump()' and replace all notions and call by 'roundtrip_dump'
-rwxr-xr-xdoc/bst2html.py2
-rw-r--r--src/buildstream/_artifact.py2
-rw-r--r--src/buildstream/_stream.py2
-rw-r--r--src/buildstream/_workspaces.py4
-rw-r--r--src/buildstream/_yaml.pyx15
-rw-r--r--tests/format/include.py4
6 files changed, 7 insertions, 22 deletions
diff --git a/doc/bst2html.py b/doc/bst2html.py
index 9d178bc18..71d497eda 100755
--- a/doc/bst2html.py
+++ b/doc/bst2html.py
@@ -197,7 +197,7 @@ def workdir(source_cache=None):
'sourcedir': source_cache,
'logdir': os.path.join(tempdir, 'logs'),
}
- _yaml.dump(config, bst_config_file)
+ _yaml.roundtrip_dump(config, bst_config_file)
yield (tempdir, bst_config_file, source_cache)
diff --git a/src/buildstream/_artifact.py b/src/buildstream/_artifact.py
index ffe92db16..dad33de3d 100644
--- a/src/buildstream/_artifact.py
+++ b/src/buildstream/_artifact.py
@@ -148,7 +148,7 @@ class Artifact():
# Store public data
with utils._tempnamedfile_name(dir=self._tmpdir) as tmpname:
- _yaml.dump(publicdata, tmpname)
+ _yaml.roundtrip_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
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index c6d748f91..c4b04f73c 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -913,7 +913,7 @@ class Stream():
}
workspaces.append(workspace_detail)
- _yaml.dump({
+ _yaml.roundtrip_dump({
'workspaces': workspaces
})
diff --git a/src/buildstream/_workspaces.py b/src/buildstream/_workspaces.py
index 95c1817ce..ed50828a3 100644
--- a/src/buildstream/_workspaces.py
+++ b/src/buildstream/_workspaces.py
@@ -125,7 +125,7 @@ class WorkspaceProject():
#
def write(self):
os.makedirs(self._directory, exist_ok=True)
- _yaml.dump(self.to_dict(), self.get_filename())
+ _yaml.roundtrip_dump(self.to_dict(), self.get_filename())
# get_filename()
#
@@ -530,7 +530,7 @@ class Workspaces():
}
}
os.makedirs(self._bst_directory, exist_ok=True)
- _yaml.dump(config, self._get_filename())
+ _yaml.roundtrip_dump(config, self._get_filename())
# _load_config()
#
diff --git a/src/buildstream/_yaml.pyx b/src/buildstream/_yaml.pyx
index 365615b73..81c456932 100644
--- a/src/buildstream/_yaml.pyx
+++ b/src/buildstream/_yaml.pyx
@@ -833,21 +833,6 @@ cpdef Node load_data(str data, int file_index=_SYNTHETIC_FILE_INDEX, str file_na
return contents
-# dump()
-#
-# Write a YAML node structure out to disk.
-#
-# This will always call `node_sanitize` on its input, so if you wanted
-# to output something close to what you read in, consider using the
-# `roundtrip_load` and `roundtrip_dump` function pair instead.
-#
-# Args:
-# contents (any): Content to write out
-# filename (str): The (optional) file name to write out to
-def dump(object contents, str filename=None):
- roundtrip_dump(node_sanitize(contents), file=filename)
-
-
# node_get_provenance()
#
# Gets the provenance for a node
diff --git a/tests/format/include.py b/tests/format/include.py
index 3bb4e4d51..8902aa3eb 100644
--- a/tests/format/include.py
+++ b/tests/format/include.py
@@ -35,7 +35,7 @@ def test_include_missing_file(cli, tmpdir):
tmpdir.join('project.conf').write('{"name": "test"}')
element = tmpdir.join('include_missing_file.bst')
- # Normally we would use dicts and _yaml.dump to write such things, but here
+ # Normally we would use dicts and _yaml.roundtrip_dump to write such things, but here
# we want to be sure of a stable line and column number.
element.write(textwrap.dedent("""
kind: manual
@@ -55,7 +55,7 @@ def test_include_dir(cli, tmpdir):
tmpdir.mkdir('subdir')
element = tmpdir.join('include_dir.bst')
- # Normally we would use dicts and _yaml.dump to write such things, but here
+ # Normally we would use dicts and _yaml.roundtrip_dump to write such things, but here
# we want to be sure of a stable line and column number.
element.write(textwrap.dedent("""
kind: manual