mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-27 16:48:09 +00:00
build: use python3 everywhere
This commit is contained in:
parent
9019ec7e2b
commit
ef5f1326dc
@ -29,7 +29,8 @@ addons:
|
|||||||
- libudev-dev
|
- libudev-dev
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- pip install ed25519 pyblake2
|
- pip3 install scons
|
||||||
|
- pip3 install ed25519 pyblake2
|
||||||
- pip3 install flake8
|
- pip3 install flake8
|
||||||
- pip3 install pytest
|
- pip3 install pytest
|
||||||
- pip3 install ecdsa mnemonic protobuf requests
|
- pip3 install ecdsa mnemonic protobuf requests
|
||||||
|
@ -8,6 +8,6 @@ class EncryptMessage(p.MessageType):
|
|||||||
2: ('message', p.BytesType, 0),
|
2: ('message', p.BytesType, 0),
|
||||||
3: ('display_only', p.BoolType, 0),
|
3: ('display_only', p.BoolType, 0),
|
||||||
4: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
4: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
5: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
5: ('coin_name', p.UnicodeType, 0), # default='Bitcoin'
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 49
|
MESSAGE_WIRE_TYPE = 49
|
||||||
|
@ -6,6 +6,6 @@ class EstimateTxSize(p.MessageType):
|
|||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('outputs_count', p.UVarintType, 0), # required
|
1: ('outputs_count', p.UVarintType, 0), # required
|
||||||
2: ('inputs_count', p.UVarintType, 0), # required
|
2: ('inputs_count', p.UVarintType, 0), # required
|
||||||
3: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
3: ('coin_name', p.UnicodeType, 0), # default='Bitcoin'
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 43
|
MESSAGE_WIRE_TYPE = 43
|
||||||
|
@ -6,7 +6,7 @@ from .MultisigRedeemScriptType import MultisigRedeemScriptType
|
|||||||
class GetAddress(p.MessageType):
|
class GetAddress(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
2: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
2: ('coin_name', p.UnicodeType, 0), # default='Bitcoin'
|
||||||
3: ('show_display', p.BoolType, 0),
|
3: ('show_display', p.BoolType, 0),
|
||||||
4: ('multisig', MultisigRedeemScriptType, 0),
|
4: ('multisig', MultisigRedeemScriptType, 0),
|
||||||
5: ('script_type', p.UVarintType, 0), # default=0
|
5: ('script_type', p.UVarintType, 0), # default=0
|
||||||
|
@ -7,6 +7,6 @@ class GetPublicKey(p.MessageType):
|
|||||||
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
2: ('ecdsa_curve_name', p.UnicodeType, 0),
|
2: ('ecdsa_curve_name', p.UnicodeType, 0),
|
||||||
3: ('show_display', p.BoolType, 0),
|
3: ('show_display', p.BoolType, 0),
|
||||||
4: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
4: ('coin_name', p.UnicodeType, 0), # default='Bitcoin'
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 11
|
MESSAGE_WIRE_TYPE = 11
|
||||||
|
@ -9,7 +9,7 @@ class LoadDevice(p.MessageType):
|
|||||||
2: ('node', HDNodeType, 0),
|
2: ('node', HDNodeType, 0),
|
||||||
3: ('pin', p.UnicodeType, 0),
|
3: ('pin', p.UnicodeType, 0),
|
||||||
4: ('passphrase_protection', p.BoolType, 0),
|
4: ('passphrase_protection', p.BoolType, 0),
|
||||||
5: ('language', p.UnicodeType, 0), # default=u'english'
|
5: ('language', p.UnicodeType, 0), # default='english'
|
||||||
6: ('label', p.UnicodeType, 0),
|
6: ('label', p.UnicodeType, 0),
|
||||||
7: ('skip_checksum', p.BoolType, 0),
|
7: ('skip_checksum', p.BoolType, 0),
|
||||||
8: ('u2f_counter', p.UVarintType, 0),
|
8: ('u2f_counter', p.UVarintType, 0),
|
||||||
|
@ -7,7 +7,7 @@ class RecoveryDevice(p.MessageType):
|
|||||||
1: ('word_count', p.UVarintType, 0),
|
1: ('word_count', p.UVarintType, 0),
|
||||||
2: ('passphrase_protection', p.BoolType, 0),
|
2: ('passphrase_protection', p.BoolType, 0),
|
||||||
3: ('pin_protection', p.BoolType, 0),
|
3: ('pin_protection', p.BoolType, 0),
|
||||||
4: ('language', p.UnicodeType, 0), # default=u'english'
|
4: ('language', p.UnicodeType, 0), # default='english'
|
||||||
5: ('label', p.UnicodeType, 0),
|
5: ('label', p.UnicodeType, 0),
|
||||||
6: ('enforce_wordlist', p.BoolType, 0),
|
6: ('enforce_wordlist', p.BoolType, 0),
|
||||||
8: ('type', p.UVarintType, 0),
|
8: ('type', p.UVarintType, 0),
|
||||||
|
@ -8,7 +8,7 @@ class ResetDevice(p.MessageType):
|
|||||||
2: ('strength', p.UVarintType, 0), # default=256
|
2: ('strength', p.UVarintType, 0), # default=256
|
||||||
3: ('passphrase_protection', p.BoolType, 0),
|
3: ('passphrase_protection', p.BoolType, 0),
|
||||||
4: ('pin_protection', p.BoolType, 0),
|
4: ('pin_protection', p.BoolType, 0),
|
||||||
5: ('language', p.UnicodeType, 0), # default=u'english'
|
5: ('language', p.UnicodeType, 0), # default='english'
|
||||||
6: ('label', p.UnicodeType, 0),
|
6: ('label', p.UnicodeType, 0),
|
||||||
7: ('u2f_counter', p.UVarintType, 0),
|
7: ('u2f_counter', p.UVarintType, 0),
|
||||||
8: ('skip_backup', p.BoolType, 0),
|
8: ('skip_backup', p.BoolType, 0),
|
||||||
|
@ -6,7 +6,7 @@ class SignMessage(p.MessageType):
|
|||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
2: ('message', p.BytesType, 0), # required
|
2: ('message', p.BytesType, 0), # required
|
||||||
3: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
3: ('coin_name', p.UnicodeType, 0), # default='Bitcoin'
|
||||||
4: ('script_type', p.UVarintType, 0), # default=0
|
4: ('script_type', p.UVarintType, 0), # default=0
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 38
|
MESSAGE_WIRE_TYPE = 38
|
||||||
|
@ -6,7 +6,7 @@ class SignTx(p.MessageType):
|
|||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('outputs_count', p.UVarintType, 0), # required
|
1: ('outputs_count', p.UVarintType, 0), # required
|
||||||
2: ('inputs_count', p.UVarintType, 0), # required
|
2: ('inputs_count', p.UVarintType, 0), # required
|
||||||
3: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
3: ('coin_name', p.UnicodeType, 0), # default='Bitcoin'
|
||||||
4: ('version', p.UVarintType, 0), # default=1
|
4: ('version', p.UVarintType, 0), # default=1
|
||||||
5: ('lock_time', p.UVarintType, 0), # default=0
|
5: ('lock_time', p.UVarintType, 0), # default=0
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ class SimpleSignTx(p.MessageType):
|
|||||||
1: ('inputs', TxInputType, p.FLAG_REPEATED),
|
1: ('inputs', TxInputType, p.FLAG_REPEATED),
|
||||||
2: ('outputs', TxOutputType, p.FLAG_REPEATED),
|
2: ('outputs', TxOutputType, p.FLAG_REPEATED),
|
||||||
3: ('transactions', TransactionType, p.FLAG_REPEATED),
|
3: ('transactions', TransactionType, p.FLAG_REPEATED),
|
||||||
4: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
4: ('coin_name', p.UnicodeType, 0), # default='Bitcoin'
|
||||||
5: ('version', p.UVarintType, 0), # default=1
|
5: ('version', p.UVarintType, 0), # default=1
|
||||||
6: ('lock_time', p.UVarintType, 0), # default=0
|
6: ('lock_time', p.UVarintType, 0), # default=0
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,6 @@ class VerifyMessage(p.MessageType):
|
|||||||
1: ('address', p.UnicodeType, 0),
|
1: ('address', p.UnicodeType, 0),
|
||||||
2: ('signature', p.BytesType, 0),
|
2: ('signature', p.BytesType, 0),
|
||||||
3: ('message', p.BytesType, 0),
|
3: ('message', p.BytesType, 0),
|
||||||
4: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
4: ('coin_name', p.UnicodeType, 0), # default='Bitcoin'
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 39
|
MESSAGE_WIRE_TYPE = 39
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
CURDIR=$(pwd)
|
CURDIR=$(pwd)
|
||||||
mkdir -p $CURDIR/pb2/
|
mkdir -p $CURDIR/pb2/
|
||||||
echo > $CURDIR/pb2/__init__.py
|
touch $CURDIR/pb2/__init__.py
|
||||||
|
|
||||||
mkdir -p ../src/trezor/messages
|
mkdir -p ../src/trezor/messages
|
||||||
|
|
||||||
@ -17,6 +17,10 @@ for i in types messages storage ; do
|
|||||||
protoc --python_out=$CURDIR/pb2/ -I/usr/include -I. $i.proto
|
protoc --python_out=$CURDIR/pb2/ -I/usr/include -I. $i.proto
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# hack to make output python 3 compatible
|
||||||
|
sed -i 's/^import types_pb2/from . import types_pb2/g' $CURDIR/pb2/messages_pb2.py
|
||||||
|
sed -i 's/^import types_pb2/from . import types_pb2/g' $CURDIR/pb2/storage_pb2.py
|
||||||
|
|
||||||
for i in types messages storage ; do
|
for i in types messages storage ; do
|
||||||
# Convert google protobuf library to trezor's internal format
|
# Convert google protobuf library to trezor's internal format
|
||||||
cd $CURDIR
|
cd $CURDIR
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# Converts Google's protobuf python definitions of TREZOR wire messages
|
# Converts Google's protobuf python definitions of TREZOR wire messages
|
||||||
# to plain-python objects as used in TREZOR Core and python-trezor
|
# to plain-python objects as used in TREZOR Core and python-trezor
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user