mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-14 03:30:02 +00:00
pb2py: add const import for micropython
This commit is contained in:
parent
4e450bb50b
commit
53aa74092e
10
tools/pb2py
10
tools/pb2py
@ -12,7 +12,12 @@ from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper
|
||||
def process_type(t, cls, msg_id, indexfile, is_upy):
|
||||
print(" * type %s" % t)
|
||||
|
||||
imports = ["import protobuf as p", ]
|
||||
if is_upy:
|
||||
imports = ["from micropython import const", ""]
|
||||
else:
|
||||
imports = []
|
||||
|
||||
imports.append("import protobuf as p")
|
||||
|
||||
out = ["", "class %s(p.MessageType):" % t, ]
|
||||
|
||||
@ -99,6 +104,9 @@ def process_type(t, cls, msg_id, indexfile, is_upy):
|
||||
def process_enum(t, cls, is_upy):
|
||||
out = []
|
||||
|
||||
if is_upy:
|
||||
out += ("from micropython import const", "")
|
||||
|
||||
print(" * enum %s" % t)
|
||||
|
||||
for k, v in cls.items():
|
||||
|
Loading…
Reference in New Issue
Block a user