Add Python util to read from a data pipe into a bytearray
The implementation of this function is inspired by
//mojo/common/data_pipe_utils.cc. It will be used in an upcoming CL.
R=qsr@chromium.org
Review URL: https://codereview.chromium.org/952223002
diff --git a/mojo/python/BUILD.gn b/mojo/python/BUILD.gn
index 041dbc0..972e0c6 100644
--- a/mojo/python/BUILD.gn
+++ b/mojo/python/BUILD.gn
@@ -2,17 +2,40 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//mojo/public/python/rules.gni")
import("//third_party/cython/rules.gni")
# GYP version: mojo/mojo.gyp:mojo_python
group("python") {
deps = [
":mojo_embedder",
+ ":packaged_utils",
+ ":utils",
":validation_util",
"//mojo/public/python",
]
}
+copy("utils") {
+ sources = [
+ "mojo_utils/__init__.py",
+ "mojo_utils/data_pipe_utils.py",
+ ]
+ outputs = [
+ "$root_out_dir/python/mojo_utils/{{source_file_part}}",
+ ]
+}
+
+python_package("packaged_utils") {
+ sources = [
+ "mojo_utils/__init__.py",
+ "mojo_utils/data_pipe_utils.py",
+ ]
+ datadeps = [
+ "//mojo/public/python:mojo_system",
+ ]
+}
+
# GYP version: mojo/mojo.gyp:mojo_python_embedder
python_binary_module("mojo_embedder") {
cython_sources = [ "system/mojo_embedder.pyx" ]