1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 09:28:13 +00:00

sort imports in pb2py

This commit is contained in:
Pavol Rusnak 2018-01-12 12:58:39 +01:00
parent 78d2c07d34
commit 8f6b2449be
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
5 changed files with 13 additions and 13 deletions

View File

@ -1,12 +1,13 @@
#!/bin/bash
CURDIR=$(pwd)
PB2DIR=$CURDIR/pb2
OUTDIR=../trezorlib/messages
INDEX=$OUTDIR/__init__.py
mkdir -p $OUTDIR
mkdir -p $PB2DIR
touch $PB2DIR/__init__.py
mkdir -p ../trezorlib/messages
INDEX=../trezorlib/messages/__init__.py
rm -f $INDEX
echo '# Automatically generated by pb2py' >> $INDEX
echo 'from __future__ import absolute_import' >> $INDEX
@ -25,7 +26,7 @@ sed -i 's/^import types_pb2/from . import types_pb2/g' $CURDIR/pb2/storage_pb2.p
for i in types messages storage ; do
# Convert google protobuf library to trezor's internal format
cd $CURDIR
./pb2py -p $CURDIR -l $INDEX $i ../trezorlib/messages/
./pb2py -p $CURDIR -l $INDEX $i $OUTDIR
done
rm -rf $PB2DIR

View File

@ -97,7 +97,7 @@ def process_type(t, cls, msg_id, indexfile, is_upy):
indexfile.write("%s = %d\n" % (t, msg_id))
# Remove duplicate imports
imports = list(set(imports))
imports = sorted(list(set(imports)))
if is_upy:
imports = ['import protobuf as p'] + imports
@ -105,7 +105,6 @@ def process_type(t, cls, msg_id, indexfile, is_upy):
imports = ['from __future__ import absolute_import',
'from .. import protobuf as p'] + imports
return imports + out

View File

@ -1,13 +1,13 @@
# Automatically generated by pb2py
from __future__ import absolute_import
from .. import protobuf as p
from .NEMMosaicSupplyChange import NEMMosaicSupplyChange
from .NEMTransfer import NEMTransfer
from .NEMMosaicCreation import NEMMosaicCreation
from .NEMTransactionCommon import NEMTransactionCommon
from .NEMAggregateModification import NEMAggregateModification
from .NEMProvisionNamespace import NEMProvisionNamespace
from .NEMImportanceTransfer import NEMImportanceTransfer
from .NEMMosaicCreation import NEMMosaicCreation
from .NEMMosaicSupplyChange import NEMMosaicSupplyChange
from .NEMProvisionNamespace import NEMProvisionNamespace
from .NEMTransactionCommon import NEMTransactionCommon
from .NEMTransfer import NEMTransfer
class NEMSignTx(p.MessageType):

View File

@ -1,8 +1,8 @@
# Automatically generated by pb2py
from __future__ import absolute_import
from .. import protobuf as p
from .TxOutputBinType import TxOutputBinType
from .TxInputType import TxInputType
from .TxOutputBinType import TxOutputBinType
from .TxOutputType import TxOutputType

View File

@ -1,8 +1,8 @@
# Automatically generated by pb2py
from __future__ import absolute_import
from .. import protobuf as p
from .TxRequestSerializedType import TxRequestSerializedType
from .TxRequestDetailsType import TxRequestDetailsType
from .TxRequestSerializedType import TxRequestSerializedType
class TxRequest(p.MessageType):