dev-python/protobuf-python: cleanup, update SRC_URI
Signed-off-by: Andreas Billmeier <b@edevau.net>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
AUX protobuf-python-3.20.3-python311.patch 3717 BLAKE2B f3a0b1b06bdbc2222fd3817b87f9b80cf609e9eb410770af31a069396eb68417f37c06603229ac8fc6aca958a9f8c0deec6b5f0812df6d7dac214b3f8622da29 SHA512 dd03b34b06e67aa4dc16281902e4676ee55169343d062b9515195ff9c92fc9cca4aaa24f83309b7f150f67a49356c41e22380bd68231dab7df04ac1c127f096f
|
||||
DIST protobuf-24.3.tar.gz 5179711 BLAKE2B 9473a1a9489d4cb92fb7ee56ac51a891cd6de005607be3f5a385957318045d2d8e6bdaa9ffa3c3f88d376b1d9a499ba9560054ae87fe031afffb62b3292ef365 SHA512 2c1a381f81bb2c0afa3a2ff6681f9f37bc7aef3a3882c371eea7284f4e9524c2a0c834de6c7f681706890eee2220a42442367b8f8dc8370f182fab9e2c37cfd2
|
||||
EBUILD protobuf-python-4.24.3.ebuild 1600 BLAKE2B 5277145793123dc3e84c10895d8bc95a06be40e3ec23100b7fd765a9dc3155c6bae0a24e921b1ccdb2c534473674c333e33e40fb859ab870ae6235539313d436 SHA512 99c5b5ddbf7209bddf17614ff8bc188723b5fcfad068576e0bd05cd57366e9ed369093995bda796ffa533b379267e76e21cce7f48a1d165173b32b357f361881
|
||||
DIST protobuf-24.3.gh.tar.gz 5179711 BLAKE2B 9473a1a9489d4cb92fb7ee56ac51a891cd6de005607be3f5a385957318045d2d8e6bdaa9ffa3c3f88d376b1d9a499ba9560054ae87fe031afffb62b3292ef365 SHA512 2c1a381f81bb2c0afa3a2ff6681f9f37bc7aef3a3882c371eea7284f4e9524c2a0c834de6c7f681706890eee2220a42442367b8f8dc8370f182fab9e2c37cfd2
|
||||
EBUILD protobuf-python-4.24.3.ebuild 1603 BLAKE2B 81b918059cea974a45da42d47a0df16ada7a11a8be71e05f93fdd0f27bc5638927c532b11c37359c72b53498ed91dcef0d5569352fd34dee67c041e5b687a37e SHA512 c02da718e48effb94edf54a35210f189f8e909135adaf3f14ab52daa10b158b66337035c61b9bd61b6fb9db908788f96a89fcfc3cc9e480141a4460ba2c4507c
|
||||
MISC metadata.xml 594 BLAKE2B 433b449286cd4cc56adf2f920215ce22f9678052a5797e683adf7c7d58920ec95f6db81587c7f839458037dd8e61b1f655068e057feede8d4e5e394ff2adae3a SHA512 b1275564f5ee25ee71f49d8e8d04e0c90be2d2b5d590f49e775f6d8f5f842aa7745140e155cf85749efe820777db9a7630c8193c707ac360e49f9b05b8eba97a
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
https://github.com/protocolbuffers/protobuf/commit/2206b63c4649cf2e8a06b66c9191c8ef862ca519
|
||||
https://github.com/protocolbuffers/protobuf/pull/10403
|
||||
https://github.com/protocolbuffers/protobuf/issues/10305
|
||||
https://bugs.gentoo.org/844184
|
||||
|
||||
From da973aff2adab60a9e516d3202c111dbdde1a50f Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Shadchin <alexandr.shadchin@gmail.com>
|
||||
Date: Sun, 14 Aug 2022 21:13:49 +0300
|
||||
Subject: [PATCH] Fix build with Python 3.11
|
||||
|
||||
The PyFrameObject structure members have been removed from the public C API.
|
||||
--- a/google/protobuf/pyext/descriptor.cc
|
||||
+++ b/google/protobuf/pyext/descriptor.cc
|
||||
@@ -58,6 +58,37 @@
|
||||
: 0) \
|
||||
: PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
|
||||
|
||||
+#if PY_VERSION_HEX < 0x030900B1 && !defined(PYPY_VERSION)
|
||||
+static PyCodeObject* PyFrame_GetCode(PyFrameObject *frame)
|
||||
+{
|
||||
+ Py_INCREF(frame->f_code);
|
||||
+ return frame->f_code;
|
||||
+}
|
||||
+
|
||||
+static PyFrameObject* PyFrame_GetBack(PyFrameObject *frame)
|
||||
+{
|
||||
+ Py_XINCREF(frame->f_back);
|
||||
+ return frame->f_back;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+#if PY_VERSION_HEX < 0x030B00A7 && !defined(PYPY_VERSION)
|
||||
+static PyObject* PyFrame_GetLocals(PyFrameObject *frame)
|
||||
+{
|
||||
+ if (PyFrame_FastToLocalsWithError(frame) < 0) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ Py_INCREF(frame->f_locals);
|
||||
+ return frame->f_locals;
|
||||
+}
|
||||
+
|
||||
+static PyObject* PyFrame_GetGlobals(PyFrameObject *frame)
|
||||
+{
|
||||
+ Py_INCREF(frame->f_globals);
|
||||
+ return frame->f_globals;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
namespace python {
|
||||
@@ -96,48 +127,66 @@ bool _CalledFromGeneratedFile(int stacklevel) {
|
||||
// This check is not critical and is somewhat difficult to implement correctly
|
||||
// in PyPy.
|
||||
PyFrameObject* frame = PyEval_GetFrame();
|
||||
+ PyCodeObject* frame_code = nullptr;
|
||||
+ PyObject* frame_globals = nullptr;
|
||||
+ PyObject* frame_locals = nullptr;
|
||||
+ bool result = false;
|
||||
+
|
||||
if (frame == nullptr) {
|
||||
- return false;
|
||||
+ goto exit;
|
||||
}
|
||||
+ Py_INCREF(frame);
|
||||
while (stacklevel-- > 0) {
|
||||
- frame = frame->f_back;
|
||||
+ PyFrameObject* next_frame = PyFrame_GetBack(frame);
|
||||
+ Py_DECREF(frame);
|
||||
+ frame = next_frame;
|
||||
if (frame == nullptr) {
|
||||
- return false;
|
||||
+ goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
- if (frame->f_code->co_filename == nullptr) {
|
||||
- return false;
|
||||
+ frame_code = PyFrame_GetCode(frame);
|
||||
+ if (frame_code->co_filename == nullptr) {
|
||||
+ goto exit;
|
||||
}
|
||||
char* filename;
|
||||
Py_ssize_t filename_size;
|
||||
- if (PyString_AsStringAndSize(frame->f_code->co_filename,
|
||||
+ if (PyString_AsStringAndSize(frame_code->co_filename,
|
||||
&filename, &filename_size) < 0) {
|
||||
// filename is not a string.
|
||||
PyErr_Clear();
|
||||
- return false;
|
||||
+ goto exit;
|
||||
}
|
||||
if ((filename_size < 3) ||
|
||||
(strcmp(&filename[filename_size - 3], ".py") != 0)) {
|
||||
// Cython's stack does not have .py file name and is not at global module
|
||||
// scope.
|
||||
- return true;
|
||||
+ result = true;
|
||||
+ goto exit;
|
||||
}
|
||||
if (filename_size < 7) {
|
||||
// filename is too short.
|
||||
- return false;
|
||||
+ goto exit;
|
||||
}
|
||||
if (strcmp(&filename[filename_size - 7], "_pb2.py") != 0) {
|
||||
// Filename is not ending with _pb2.
|
||||
- return false;
|
||||
+ goto exit;
|
||||
}
|
||||
|
||||
- if (frame->f_globals != frame->f_locals) {
|
||||
+ frame_globals = PyFrame_GetGlobals(frame);
|
||||
+ frame_locals = PyFrame_GetLocals(frame);
|
||||
+ if (frame_globals != frame_locals) {
|
||||
// Not at global module scope
|
||||
- return false;
|
||||
+ goto exit;
|
||||
}
|
||||
#endif
|
||||
- return true;
|
||||
+ result = true;
|
||||
+exit:
|
||||
+ Py_XDECREF(frame_globals);
|
||||
+ Py_XDECREF(frame_locals);
|
||||
+ Py_XDECREF(frame_code);
|
||||
+ Py_XDECREF(frame);
|
||||
+ return result;
|
||||
}
|
||||
|
||||
// If the calling code is not a _pb2.py file, raise AttributeError.
|
||||
|
||||
@@ -22,7 +22,7 @@ if [[ "${PV}" == *9999 ]]; then
|
||||
else
|
||||
SRC_URI="
|
||||
https://github.com/protocolbuffers/protobuf/archive/v${PARENT_PV}.tar.gz
|
||||
-> ${PARENT_P}.tar.gz
|
||||
-> ${PARENT_P}.gh.tar.gz
|
||||
"
|
||||
KEYWORDS="amd64 arm arm64 x86"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user