1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-21 05:48:23 +00:00
trezor-firmware/tools/build_pb.sh

22 lines
553 B
Bash
Raw Normal View History

2016-04-26 23:32:57 +00:00
#!/bin/bash
CURDIR=$(pwd)
mkdir -p $CURDIR/pb2/
echo > $CURDIR/pb2/__init__.py
2016-04-26 23:32:57 +00:00
2016-09-21 12:12:46 +00:00
INDEX=../src/trezor/messages/wire_types.py
rm -f $INDEX
2016-04-27 20:44:37 +00:00
for i in types messages storage ; do
2016-04-26 23:32:57 +00:00
# Compile .proto files to python2 modules using google protobuf library
cd $CURDIR/../../trezor-common/protob
protoc --python_out=$CURDIR/pb2/ -I/usr/include -I. $i.proto
done
2016-04-26 23:32:57 +00:00
for i in types messages storage ; do
2016-04-26 23:32:57 +00:00
# Convert google protobuf library to trezor's internal format
cd $CURDIR
2016-09-21 12:12:46 +00:00
./pb2py $i ../src/trezor/messages/ $INDEX
2016-04-26 23:32:57 +00:00
done
rm -rf $CURDIR/pb2/