dev-python/protobuf-python: new package, add 4.24.3

Signed-off-by: Andreas Billmeier <b@edevau.net>
This commit is contained in:
2023-10-28 14:41:21 +02:00
committed by Andreas Billmeier
parent bcafb7f4cd
commit a693df2345
5 changed files with 237 additions and 3 deletions

View File

@@ -612,14 +612,14 @@ A daily compile test is run at Github with Python 3.9 to catch general faults. E
## Licenses
This repository itself is released under GPL-3 (like most Gentoo repositories), all work on the depending components under the licenses they came from. Perhaps you came here because I filed an issue at your component about a bad or missing license. It is easy to [assign a license](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-license-to-a-repository). During cleanups and license investigations I have been asked often which license to choose. I am not a lawyer, but I can offer the following table, counted over this repository, perhaps this helps your decision. If a package has more than one license listed, all of them are counted.
There are 1837 Ebuilds in total, 1826 of them have in total 1841 (40 different) licenses assigned.
There are 1839 Ebuilds in total, 1828 of them have in total 1843 (40 different) licenses assigned.
|License| Ebuilds using it|
|-------|-----|
|MIT|1071|
|Apache-2.0|378|
|Apache-2.0|379|
|GPL-3|116|
|BSD|103|
|BSD|104|
|GPL-2|26|
|LGPL-3|24|
|all-rights-reserved|15|

View File

@@ -0,0 +1,4 @@
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
MISC metadata.xml 594 BLAKE2B 433b449286cd4cc56adf2f920215ce22f9678052a5797e683adf7c7d58920ec95f6db81587c7f839458037dd8e61b1f655068e057feede8d4e5e394ff2adae3a SHA512 b1275564f5ee25ee71f49d8e8d04e0c90be2d2b5d590f49e775f6d8f5f842aa7745140e155cf85749efe820777db9a7630c8193c707ac360e49f9b05b8eba97a

View File

@@ -0,0 +1,132 @@
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.

View File

@@ -0,0 +1,19 @@
<?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>

View File

@@ -0,0 +1,79 @@
# Copyright 1999-2023 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}.tar.gz
"
KEYWORDS="amd64 arm arm64 x86"
fi
DESCRIPTION="Google's Protocol Buffers - Python bindings"
HOMEPAGE="
https://developers.google.com/protocol-buffers/
https://pypi.org/project/protobuf/
"
LICENSE="BSD"
SLOT="0/24.3.0"
S="${WORKDIR}/${PARENT_P}/python"
BDEPEND="
"
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=(
)
python_prepare_all() {
pushd "${WORKDIR}/${PARENT_P}" > /dev/null || die
[[ -n "${PARENT_PATCHES[@]}" ]] && eapply "${PARENT_PATCHES[@]}"
eapply_user
popd > /dev/null || 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
}