Browse Source

Fix macOS sed scripts

Lutz Roeder 7 years ago
parent
commit
80eb68fa97
2 changed files with 3 additions and 5 deletions
  1. 1 3
      tools/caffe
  2. 2 2
      tools/tflite

+ 1 - 3
tools/caffe

@@ -37,9 +37,7 @@ sync() {
 
 schema() {
     bold "caffe schema"
-    cp ${third_party}/${identifier}/src/caffe/proto/caffe.proto ${tools}
-    sed -i -e 's/required float min = 1;/optional float min = 1;/g' ${tools}/caffe.proto 
-    sed -i -e 's/required float max = 2;/optional float max = 2;/g' ${tools}/caffe.proto
+    sed 's/required float min = 1;/optional float min = 1;/g;s/required float max = 2;/optional float max = 2;/g' <${third_party}/${identifier}/src/caffe/proto/caffe.proto >${tools}/caffe.proto
     ${node_modules}/protobufjs/bin/pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --keep-case --decode-text -r caffe -o ${src}/caffe-proto.js ${tools}/caffe.proto
     rm ${tools}/caffe.proto
     node ${tools}/update_pbjs.js array ${src}/caffe-proto.js data float 1

+ 2 - 2
tools/tflite

@@ -1,5 +1,6 @@
 #!/bin/bash
 
+set -e
 
 root=$(cd $(dirname ${0})/..; pwd)
 build=${root}/build
@@ -65,8 +66,7 @@ install() {
 
 schema() {
     bold "tflite schema"
-    cp ${third_party}/tensorflow/tensorflow/lite/schema/schema.fbs ${tools}/tflite.schema.fbs
-    sed -i 's/namespace tflite\;/namespace tflite_schema\;/' ${tools}/tflite.schema.fbs
+    sed 's/namespace tflite;/namespace tflite_schema;/g' <${third_party}/tensorflow/tensorflow/lite/schema/schema.fbs >${tools}/tflite.schema.fbs
     ${third_party}/flatbuffers/flatc --no-js-exports --js ${tools}/tflite.schema.fbs
     mv ./tflite.schema_generated.js ${src}/tflite-schema.js
     rm ${tools}/tflite.schema.fbs