It seems py-protobuf is broken, maybe after the recent protobuf
update?
$ echo 'syntax = "proto2"; message foo { optional bool bar = 1; }' > foo.proto
$ protoc --python_out=. foo.proto
$ python3 -c 'import foo_pb2'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/tim/test/foo_pb2.py", line 21, in <module>
create_key=_descriptor._internal_create_key,
AttributeError: module 'google.protobuf.descriptor' has no attribute
'_internal_create_key'
Updating py-protobuf to the latest version fixes it. OK?
Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/py-protobuf/Makefile,v
retrieving revision 1.4
diff -p -u -r1.4 Makefile
--- Makefile 15 Sep 2019 13:25:36 -0000 1.4
+++ Makefile 10 Jul 2020 07:39:48 -0000
@@ -2,7 +2,7 @@
COMMENT= Google data interchange format (protocol buffers)
-MODPY_EGG_VERSION= 3.9.1
+MODPY_EGG_VERSION= 3.12.2
DISTNAME= protobuf-${MODPY_EGG_VERSION}
PKGNAME= py-${DISTNAME}
Index: distinfo
===================================================================
RCS file: /cvs/ports/devel/py-protobuf/distinfo,v
retrieving revision 1.2
diff -p -u -r1.2 distinfo
--- distinfo 15 Sep 2019 13:25:36 -0000 1.2
+++ distinfo 10 Jul 2020 07:39:48 -0000
@@ -1,2 +1,2 @@
-SHA256 (protobuf-3.9.1.tar.gz) = 2DGwR71pvsr2QBmkcXnrIhGKUN0Ag0BlUmapBsacZBc=
-SIZE (protobuf-3.9.1.tar.gz) = 259690
+SHA256 (protobuf-3.12.2.tar.gz) = Se+KtMJ4EqiadvqJT+egj0LyFHB4OSwN7lHUpETvbfU=
+SIZE (protobuf-3.12.2.tar.gz) = 265454