1
0
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:
Pavol Rusnak 2017-06-07 19:05:26 +02:00
parent 4e450bb50b
commit 53aa74092e
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -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():