Correctly add newline character when concatenating schema generated python srcs

The last sed command used for adding the import statement and the '\n' was
working as intended on Linux, but was failing on macOS, due to the difference in
sed behavior between GNU and BSD.

Fixed the issue by using an actual newline character with $'\n', which correctly
works on both platforms.

Fixes https://github.com/tensorflow/tensorflow/issues/39756

PiperOrigin-RevId: 313691192
Change-Id: I96e5544c03641bae05753e8f7d1346c8aa1c0f6e
This commit is contained in:
YoungSeok Yoon 2020-05-28 17:27:56 -07:00 committed by TensorFlower Gardener
parent 12bda81b3d
commit f9fb66cdb7

View File

@ -362,7 +362,7 @@ def _concat_flatbuffer_py_srcs_impl(ctx):
"sed 's/from flatbuffers." + "sed 's/from flatbuffers." +
"/from flatbuffers.python.flatbuffers./' |" + "/from flatbuffers.python.flatbuffers./' |" +
"sed '1s/^/from flatbuffers.python " + "sed '1s/^/from flatbuffers.python " +
"import flatbuffers\\n/' > %s" "import flatbuffers\\'$'\\n/' > %s"
) % ( ) % (
ctx.attr.deps[0].files.to_list()[0].path, ctx.attr.deps[0].files.to_list()[0].path,
ctx.outputs.out.path, ctx.outputs.out.path,