From 27e872e6c0386cbefbbdddde42b4dacaba494d87 Mon Sep 17 00:00:00 2001 From: Sam James Date: Sun, 5 Jul 2026 21:12:10 +0100 Subject: [PATCH] dev-python/dbus-python: enable py3.15 Contains a revert of a small feature which seems to be incomplete according to the upstream discussion. Do as Fedora did. Signed-off-by: Sam James --- .../dbus-python/dbus-python-1.4.0-r1.ebuild | 98 +++++++++++++ .../files/dbus-python-1.4.0-py315.patch | 132 ++++++++++++++++++ 2 files changed, 230 insertions(+) create mode 100644 dev-python/dbus-python/dbus-python-1.4.0-r1.ebuild create mode 100644 dev-python/dbus-python/files/dbus-python-1.4.0-py315.patch diff --git a/dev-python/dbus-python/dbus-python-1.4.0-r1.ebuild b/dev-python/dbus-python/dbus-python-1.4.0-r1.ebuild new file mode 100644 index 0000000000000..f04c8390d7a24 --- /dev/null +++ b/dev-python/dbus-python/dbus-python-1.4.0-r1.ebuild @@ -0,0 +1,98 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{12..15} ) +PYTHON_REQ_USE="threads(+)" + +inherit autotools python-r1 + +DESCRIPTION="Python bindings for the D-Bus messagebus" +HOMEPAGE=" + https://www.freedesktop.org/wiki/Software/DBusBindings/ + https://dbus.freedesktop.org/doc/dbus-python/ +" +SRC_URI="https://dbus.freedesktop.org/releases/${PN}/${P}.tar.xz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" +IUSE="doc examples test" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" +RESTRICT="!test? ( test )" + +DEPEND=" + ${PYTHON_DEPS} + >=sys-apps/dbus-1.8:= + >=dev-libs/glib-2.40 +" +RDEPEND=" + ${DEPEND} +" +BDEPEND=" + dev-build/autoconf-archive + virtual/pkgconfig + doc? ( + $(python_gen_any_dep ' + dev-python/sphinx[${PYTHON_USEDEP}] + dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}] + ') + ) + test? ( + dev-python/pygobject:3[${PYTHON_USEDEP}] + dev-python/tap-py[${PYTHON_USEDEP}] + ) +" + +PATCHES=( + "${FILESDIR}"/${PN}-1.4.0-py315.patch +) + +python_check_deps() { + python_has_version "dev-python/sphinx[${PYTHON_USEDEP}]" \ + "dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}]" +} + +src_prepare() { + default + # Update py-compile, bug 529502. + eautoreconf + python_copy_sources +} + +src_configure() { + use doc && python_setup + local SPHINX_IMPL=${EPYTHON} + + configuring() { + local myconf=( + --disable-documentation + + # Work around broken AX_PYTHON_DEVEL macro. + # https://bugs.gentoo.org/815136 + PYTHON_EXTRA_LIBS=' ' + ) + use doc && [[ ${EPYTHON} == ${SPHINX_IMPL} ]] && + myconf+=( --enable-documentation ) + + econf "${myconf[@]}" + } + python_foreach_impl run_in_build_dir configuring +} + +src_compile() { + python_foreach_impl run_in_build_dir default +} + +src_test() { + unset DBUS_SESSION_BUS_ADDRESS + python_foreach_impl run_in_build_dir default +} + +src_install() { + python_foreach_impl run_in_build_dir default + find "${D}" -name '*.la' -type f -delete || die + + use examples && dodoc -r examples +} diff --git a/dev-python/dbus-python/files/dbus-python-1.4.0-py315.patch b/dev-python/dbus-python/files/dbus-python-1.4.0-py315.patch new file mode 100644 index 0000000000000..b2e5aee4bffb7 --- /dev/null +++ b/dev-python/dbus-python/files/dbus-python-1.4.0-py315.patch @@ -0,0 +1,132 @@ +https://gitlab.freedesktop.org/dbus/dbus-python/-/work_items/59 +https://src.fedoraproject.org/rpms/dbus-python/blob/rawhide/f/Revert-using-Py_TPFLAGS_MANAGED_WEAKREF.patch + +From 32191526f73fa4ac6f760848c354b1353920755e Mon Sep 17 00:00:00 2001 +From: Karolina Surma +Date: Wed, 14 Jan 2026 21:45:55 +0100 +Subject: [PATCH] Revert using Py_TPFLAGS_MANAGED_WEAKREF + +Added in https://gitlab.freedesktop.org/dbus/dbus-python/-/merge_requests/35 +The feature is incomplete and doesn't work. +--- + dbus_bindings/conn-internal.h | 2 -- + dbus_bindings/conn.c | 11 ----------- + dbus_bindings/server.c | 13 ------------- + 3 files changed, 26 deletions(-) + +diff --git a/dbus_bindings/conn-internal.h b/dbus_bindings/conn-internal.h +index ae47816..d333d27 100644 +--- a/dbus_bindings/conn-internal.h ++++ b/dbus_bindings/conn-internal.h +@@ -42,10 +42,8 @@ typedef struct { + */ + PyObject *object_paths; + +-#if !DBUSPY_PY_VERSION_AT_LEAST(3, 12, 0, 0) + /* Weak-references list to make Connections weakly referenceable */ + PyObject *weaklist; +-#endif + + dbus_bool_t has_mainloop; + } Connection; +diff --git a/dbus_bindings/conn.c b/dbus_bindings/conn.c +index 54efc49..5dd4b5e 100644 +--- a/dbus_bindings/conn.c ++++ b/dbus_bindings/conn.c +@@ -238,9 +238,7 @@ DBusPyConnection_NewConsumingDBusConnection(PyTypeObject *cls, + self->has_mainloop = (mainloop != Py_None); + self->conn = NULL; + self->filters = PyList_New(0); +-#if !DBUSPY_PY_VERSION_AT_LEAST(3, 12, 0, 0) + self->weaklist = NULL; +-#endif + if (!self->filters) goto err; + self->object_paths = PyDict_New(); + if (!self->object_paths) goto err; +@@ -394,9 +392,7 @@ static void Connection_tp_dealloc(Connection *self) + /* avoid clobbering any pending exception */ + PyErr_Fetch(&et, &ev, &etb); + +-#if !DBUSPY_PY_VERSION_AT_LEAST(3, 12, 0, 0) + if (self->weaklist) +-#endif + { + PyObject_ClearWeakRefs((PyObject *)self); + } +@@ -460,19 +456,12 @@ PyTypeObject DBusPyConnection_Type = { + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ +-#if DBUSPY_PY_VERSION_AT_LEAST(3, 12, 0, 0) +- Py_TPFLAGS_MANAGED_WEAKREF | +-#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + Connection_tp_doc, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ +-#if DBUSPY_PY_VERSION_AT_LEAST(3, 12, 0, 0) +- 0, /*tp_weaklistoffset*/ +-#else + offsetof(Connection, weaklist), /*tp_weaklistoffset*/ +-#endif + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + DBusPyConnection_tp_methods, /*tp_methods*/ +diff --git a/dbus_bindings/server.c b/dbus_bindings/server.c +index d250a1d..9382fe6 100644 +--- a/dbus_bindings/server.c ++++ b/dbus_bindings/server.c +@@ -38,10 +38,8 @@ typedef struct { + /* The Connection subtype for which this Server is a factory */ + PyObject *conn_class; + +-#if !DBUSPY_PY_VERSION_AT_LEAST(3, 12, 0, 0) + /* Weak-references list to make server weakly referenceable */ + PyObject *weaklist; +-#endif + + PyObject *mainloop; + } Server; +@@ -425,9 +423,7 @@ Server_tp_new(PyTypeObject *cls, PyObject *args, PyObject *kwargs) + return NULL; + } + +-#if !DBUSPY_PY_VERSION_AT_LEAST(3, 12, 0, 0) + ((Server *)self)->weaklist = NULL; +-#endif + TRACE(self); + + return self; +@@ -442,9 +438,7 @@ static void Server_tp_dealloc(Server *self) + /* avoid clobbering any pending exception */ + PyErr_Fetch(&et, &ev, &etb); + +-#if !DBUSPY_PY_VERSION_AT_LEAST(3, 12, 0, 0) + if (self->weaklist) +-#endif + { + PyObject_ClearWeakRefs((PyObject *)self); + } +@@ -577,19 +571,12 @@ PyTypeObject DBusPyServer_Type = { + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ +-#if DBUSPY_PY_VERSION_AT_LEAST(3, 12, 0, 0) +- Py_TPFLAGS_MANAGED_WEAKREF | +-#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + Server_tp_doc, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ +-#if DBUSPY_PY_VERSION_AT_LEAST(3, 12, 0, 0) +- 0, /*tp_weaklistoffset*/ +-#else + offsetof(Server, weaklist), /*tp_weaklistoffset*/ +-#endif + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + DBusPyServer_tp_methods,/*tp_methods*/ +-- +2.52.0