dev-python/protobuf-python: Support Python 3.7.
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Tue, 2 Oct 2018 19:50:26 +0000 (21:50 +0200)
committerMike Gilbert <floppym@gentoo.org>
Tue, 2 Oct 2018 20:07:26 +0000 (16:07 -0400)
Closes: https://bugs.gentoo.org/664508

Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
dev-python/protobuf-python/files/protobuf-python-3.6.1-python-3.7.patch [new file with mode: 0644]
dev-python/protobuf-python/protobuf-python-3.6.1.ebuild

diff --git a/dev-python/protobuf-python/files/protobuf-python-3.6.1-python-3.7.patch b/dev-python/protobuf-python/files/protobuf-python-3.6.1-python-3.7.patch
new file mode 100644 (file)
index 0000000..bd4ce9d
--- /dev/null
@@ -0,0 +1,67 @@
+https://github.com/protocolbuffers/protobuf/pull/4862
+https://github.com/protocolbuffers/protobuf/commit/0a59054c30e4f0ba10f10acfc1d7f3814c63e1a7
+
+--- /python/google/protobuf/pyext/descriptor.cc
++++ /python/google/protobuf/pyext/descriptor.cc
+@@ -56,7 +56,7 @@
+   #endif
+   #define PyString_AsStringAndSize(ob, charpp, sizep) \
+     (PyUnicode_Check(ob)? \
+-       ((*(charpp) = PyUnicode_AsUTF8AndSize(ob, (sizep))) == NULL? -1: 0): \
++       ((*(charpp) = const_cast<char*>(PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL? -1: 0): \
+        PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
+ #endif
+--- /python/google/protobuf/pyext/descriptor_containers.cc
++++ /python/google/protobuf/pyext/descriptor_containers.cc
+@@ -66,7 +66,7 @@
+   #endif
+   #define PyString_AsStringAndSize(ob, charpp, sizep) \
+     (PyUnicode_Check(ob)? \
+-       ((*(charpp) = PyUnicode_AsUTF8AndSize(ob, (sizep))) == NULL? -1: 0): \
++       ((*(charpp) = const_cast<char*>(PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL? -1: 0): \
+        PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
+ #endif
+--- /python/google/protobuf/pyext/descriptor_pool.cc
++++ /python/google/protobuf/pyext/descriptor_pool.cc
+@@ -48,7 +48,7 @@
+   #endif
+   #define PyString_AsStringAndSize(ob, charpp, sizep) \
+     (PyUnicode_Check(ob)? \
+-       ((*(charpp) = PyUnicode_AsUTF8AndSize(ob, (sizep))) == NULL? -1: 0): \
++       ((*(charpp) = const_cast<char*>(PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL? -1: 0): \
+        PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
+ #endif
+--- /python/google/protobuf/pyext/extension_dict.cc
++++ /python/google/protobuf/pyext/extension_dict.cc
+@@ -53,7 +53,7 @@
+   #endif
+   #define PyString_AsStringAndSize(ob, charpp, sizep) \
+     (PyUnicode_Check(ob)? \
+-       ((*(charpp) = PyUnicode_AsUTF8AndSize(ob, (sizep))) == NULL? -1: 0): \
++       ((*(charpp) = const_cast<char*>(PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL? -1: 0): \
+        PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
+ #endif
+--- /python/google/protobuf/pyext/message.cc
++++ /python/google/protobuf/pyext/message.cc
+@@ -79,7 +79,7 @@
+     (PyUnicode_Check(ob)? PyUnicode_AsUTF8(ob): PyBytes_AsString(ob))
+   #define PyString_AsStringAndSize(ob, charpp, sizep) \
+     (PyUnicode_Check(ob)? \
+-       ((*(charpp) = PyUnicode_AsUTF8AndSize(ob, (sizep))) == NULL? -1: 0): \
++       ((*(charpp) = const_cast<char*>(PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL? -1: 0): \
+        PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
+   #endif
+ #endif
+@@ -1529,7 +1529,7 @@
+     return NULL;
+   }
+ #else
+-  field_name = PyUnicode_AsUTF8AndSize(arg, &size);
++  field_name = const_cast<char*>(PyUnicode_AsUTF8AndSize(arg, &size));
+   if (!field_name) {
+     return NULL;
+   }
index d2f29ce98df9045dbd65cc743179463efc6b76a6..3d8397734fcd50aa1a45b82570b6ec6305f535f4 100644 (file)
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="6"
-PYTHON_COMPAT=(python{2_7,3_4,3_5,3_6})
+PYTHON_COMPAT=(python{2_7,3_4,3_5,3_6,3_7})
 
 inherit distutils-r1
 
@@ -27,6 +27,7 @@ S="${WORKDIR}/protobuf-${PV}/python"
 
 python_prepare_all() {
        eapply -p2 "${FILESDIR}/${PN}-3.5.2-google.protobuf.pyext._message.MessageMeta.patch"
+       eapply -p2 "${FILESDIR}/${PN}-3.6.1-python-3.7.patch"
        distutils-r1_python_prepare_all
 }