You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-firmware/tools/build_protobuf

27 lines
720 B

#!/bin/bash
CURDIR=$(pwd)
mkdir -p $CURDIR/pb2/
echo > $CURDIR/pb2/__init__.py
mkdir -p ../src/trezor/messages
INDEX=../src/trezor/messages/wire_types.py
rm -f $INDEX
echo '# Automatically generated by pb2py' >> $INDEX
echo 'from micropython import const' >> $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
./pb2py -m -p $CURDIR -i $INDEX $i ../src/trezor/messages/
done
rm -rf $CURDIR/pb2/