2017-12-12 15:40:11 +00:00
|
|
|
#!/bin/bash
|
|
|
|
CURDIR=$(pwd)
|
|
|
|
mkdir -p $CURDIR/pb2/
|
|
|
|
|
|
|
|
mkdir -p ../trezorlib/messages
|
|
|
|
|
|
|
|
INDEX=../trezorlib/messages/__init__.py
|
|
|
|
rm -f $INDEX
|
|
|
|
echo '# Automatically generated by pb2py' >> $INDEX
|
|
|
|
echo '' >> $INDEX
|
|
|
|
|
|
|
|
for i in types messages storage ; do
|
|
|
|
# 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
|
|
|
|
|
|
|
|
for i in types messages storage ; do
|
|
|
|
# Convert google protobuf library to trezor's internal format
|
|
|
|
cd $CURDIR
|
2017-12-24 12:04:36 +00:00
|
|
|
./pb2py -P "trezorlib.protobuf" -p $CURDIR/pb2 -l $INDEX $i ../trezorlib/messages/
|
2017-12-12 15:40:11 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
rm -rf $CURDIR/pb2/
|