Added compatibility with CPython

This commit is contained in:
slush 2017-12-14 02:53:42 +01:00
parent 4916393139
commit f8071c9a97
1 changed files with 6 additions and 1 deletions

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 = []
if is_upy:
imports = ['import protobuf as p']
else:
imports = ['from __future__ import absolute_import',
'from .. import protobuf as p']
out = ["", "", "class %s(p.MessageType):" % t, ]
if cls.DESCRIPTOR.fields_by_name: