mirror of
https://github.com/pentoo/pentoo-overlay
synced 2026-04-29 10:11:12 +02:00
protobuf-python: delete, move back to Gentoo, https://bugs.gentoo.org/933068
This commit is contained in:
parent
f2208d8e98
commit
617a0158dc
4 changed files with 0 additions and 234 deletions
|
|
@ -1 +0,0 @@
|
|||
DIST protobuf-21.12.gh.tar.gz 5141166 BLAKE2B 33500612d103afb817062486a741e8e5503f82c42c70054d47d1899e6bb79f3fdde2666cad5b8eff6e1bc539c3b0cdf9f2b125ce7e5d3a459a69e84d67ab535e SHA512 2dc8f552388438268d8b9f7a9e84c6abf1736be3d5031438c789c317410c9f4b5cedd25bf7da6d67b3ba32ca890869f9ddaab2284d6ac0e734a5b135ffbb1346
|
||||
|
|
@ -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.
|
||||
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person" proxied="yes">
|
||||
<email>arfrever.fta@gmail.com</email>
|
||||
<name>Arfrever Frehtes Taifersar Arahesis</name>
|
||||
</maintainer>
|
||||
<maintainer type="project">
|
||||
<email>cjk@gentoo.org</email>
|
||||
<name>Cjk</name>
|
||||
</maintainer>
|
||||
<slots>
|
||||
<subslots>Soname version number of Protobuf</subslots>
|
||||
</slots>
|
||||
<upstream>
|
||||
<remote-id type="github">protocolbuffers/protobuf</remote-id>
|
||||
<remote-id type="pypi">protobuf</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
# Copyright 2008-2024 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
DISTUTILS_EXT=1
|
||||
DISTUTILS_USE_PEP517=setuptools
|
||||
PYTHON_COMPAT=( python3_{10..12} )
|
||||
|
||||
inherit distutils-r1
|
||||
|
||||
PARENT_PN="${PN/-python/}"
|
||||
PARENT_PV="$(ver_cut 2-)"
|
||||
PARENT_P="${PARENT_PN}-${PARENT_PV}"
|
||||
|
||||
if [[ "${PV}" == *9999 ]]; then
|
||||
inherit git-r3
|
||||
|
||||
EGIT_REPO_URI="https://github.com/protocolbuffers/protobuf.git"
|
||||
EGIT_SUBMODULES=()
|
||||
EGIT_CHECKOUT_DIR="${WORKDIR}/${PARENT_P}"
|
||||
else
|
||||
SRC_URI="
|
||||
https://github.com/protocolbuffers/protobuf/archive/v${PARENT_PV}.tar.gz
|
||||
-> ${PARENT_P}.gh.tar.gz
|
||||
"
|
||||
KEYWORDS="~alpha amd64 ~arm arm64 ~loong ~mips ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux ~x64-macos"
|
||||
fi
|
||||
|
||||
DESCRIPTION="Google's Protocol Buffers - Python bindings"
|
||||
HOMEPAGE="
|
||||
https://developers.google.com/protocol-buffers/
|
||||
https://pypi.org/project/protobuf/
|
||||
"
|
||||
|
||||
LICENSE="BSD"
|
||||
SLOT="0/3.${PARENT_PV}.0"
|
||||
|
||||
S="${WORKDIR}/${PARENT_P}/python"
|
||||
|
||||
DEPEND="
|
||||
${PYTHON_DEPS}
|
||||
"
|
||||
RDEPEND="
|
||||
${BDEPEND}
|
||||
dev-libs/protobuf:${SLOT}
|
||||
"
|
||||
|
||||
distutils_enable_tests setup.py
|
||||
|
||||
# Same than PATCHES but from repository's root directory,
|
||||
# please see function `python_prepare_all` below.
|
||||
# Simplier for users IMHO.
|
||||
PARENT_PATCHES=(
|
||||
)
|
||||
|
||||
# Here for patches within "python/" subdirectory.
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${PN}-3.20.3-python311.patch
|
||||
)
|
||||
|
||||
python_prepare_all() {
|
||||
pushd "${WORKDIR}/${PARENT_P}" > /dev/null || die
|
||||
[[ -n "${PARENT_PATCHES[@]}" ]] && eapply "${PARENT_PATCHES[@]}"
|
||||
eapply_user
|
||||
popd > /dev/null || die
|
||||
|
||||
# py3.12
|
||||
sed -i -e 's:assertRaisesRegexp:assertRaisesRegex:' \
|
||||
google/protobuf/internal/json_format_test.py || die
|
||||
|
||||
distutils-r1_python_prepare_all
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
DISTUTILS_ARGS=( --cpp_implementation )
|
||||
}
|
||||
|
||||
python_compile() {
|
||||
distutils-r1_python_compile
|
||||
find "${BUILD_DIR}/install" -name "*.pth" -type f -delete || die
|
||||
}
|
||||
Loading…
Reference in a new issue