commit:     54666dc853bb782e452e46be1e00c4a70a897b27
Author:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 22 07:21:53 2021 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Wed Sep 22 07:45:09 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=54666dc8

dev-python/pygobject: bump to 3.42.0

The py3.10 patch is updated to upstreamed variant.

Package-Manager: Portage-3.0.20, Repoman-3.0.2
Signed-off-by: Mart Raudsepp <leio <AT> gentoo.org>

 dev-python/pygobject/Manifest                      |  1 +
 .../pygobject-3.42.0-dynamicimporter-py310.patch   | 61 +++++++++++++++++
 dev-python/pygobject/pygobject-3.42.0.ebuild       | 78 ++++++++++++++++++++++
 profiles/package.mask                              |  1 +
 4 files changed, 141 insertions(+)

diff --git a/dev-python/pygobject/Manifest b/dev-python/pygobject/Manifest
index 20597c1fe1e..cccbe5e376b 100644
--- a/dev-python/pygobject/Manifest
+++ b/dev-python/pygobject/Manifest
@@ -1 +1,2 @@
 DIST pygobject-3.40.1.tar.xz 556104 BLAKE2B 
e6a092bee68121d9ef82f41f21c9811f384b8578c48de445f707f1b0de124cf38d899d34b8f4269a154ebd4e323afdfa7afef5c0c5cc5dc451b2cd68b30da04b
 SHA512 
a8350f43ea99c93aa66a23102d4ee2ca3c7f8ec2c8bcf5cd142dd097b4fb38167f1713efff3584aa323c34656c911fb940e462c83c02b107e4aad93d005022f7
+DIST pygobject-3.42.0.tar.xz 557060 BLAKE2B 
25c0634dcb713f4059d19ff2efdd67004e1343f49982123686f4df71fc2678583244dab7a22160f42d5361c3e5c6e38bcd8ccaeeafb3e1d885e5d5febaa9dde1
 SHA512 
2f3e9187cb8dd7ccbf139a58ea348732fc7cb95dbf4bee2ba8f78003a7540d90c0b29153d93f50bf613c2d43f0de0ec8971c61c358d48552e42ce17775a178dd

diff --git 
a/dev-python/pygobject/files/pygobject-3.42.0-dynamicimporter-py310.patch 
b/dev-python/pygobject/files/pygobject-3.42.0-dynamicimporter-py310.patch
new file mode 100644
index 00000000000..cf292ffbf7c
--- /dev/null
+++ b/dev-python/pygobject/files/pygobject-3.42.0-dynamicimporter-py310.patch
@@ -0,0 +1,61 @@
+From dea457c0754550e210ab3cca9da8be1ae52d1d31 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <[email protected]>
+Date: Tue, 18 May 2021 12:31:51 +0200
+Subject: [PATCH] Implement DynamicImporter.find_spec()
+
+On Python 3.10, the code raised an ImportWarning:
+
+    ImportWarning: DynamicImporter.find_spec() not found; falling back to 
find_module()
+
+See https://docs.python.org/3.10/whatsnew/3.10.html#deprecated
+
+> Starting in this release, there will be a concerted effort to begin cleaning
+> up old import semantics that were kept for Python 2.7 compatibility.
+> Specifically, find_loader()/find_module() (superseded by find_spec()),
+> load_module() (superseded by exec_module()), module_repr()
+> (which the import system takes care of for you),
+> the __package__ attribute (superseded by __spec__.parent),
+> the __loader__ attribute (superseded by __spec__.loader),
+> and the __cached__ attribute (superseded by __spec__.cached)
+> will slowly be removed (as well as other classes and methods in importlib).
+> ImportWarning and/or DeprecationWarning will be raised as appropriate to help
+> identify code which needs updating during this transition.
+
+Fixes https://gitlab.gnome.org/GNOME/pygobject/-/issues/473
+---
+ gi/importer.py | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/gi/importer.py b/gi/importer.py
+index 32967974..63788776 100644
+--- a/gi/importer.py
++++ b/gi/importer.py
+@@ -107,15 +107,20 @@ class DynamicImporter(object):
+     def __init__(self, path):
+         self.path = path
+ 
+-    def find_module(self, fullname, path=None):
++    def _find_module_check(self, fullname):
+         if not fullname.startswith(self.path):
+-            return
++            return False
+ 
+         path, namespace = fullname.rsplit('.', 1)
+-        if path != self.path:
+-            return
++        return path == self.path
++
++    def find_spec(self, fullname, path=None, target=None):
++        if self._find_module_check(fullname):
++            return importlib.util.spec_from_loader(fullname, self)
+ 
+-        return self
++    def find_module(self, fullname, path=None):
++        if self._find_module_check(fullname):
++            return self
+ 
+     def load_module(self, fullname):
+         if fullname in sys.modules:
+-- 
+2.32.0
+

diff --git a/dev-python/pygobject/pygobject-3.42.0.ebuild 
b/dev-python/pygobject/pygobject-3.42.0.ebuild
new file mode 100644
index 00000000000..01f7b7055eb
--- /dev/null
+++ b/dev-python/pygobject/pygobject-3.42.0.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7..10} )
+
+inherit gnome.org meson python-r1 virtualx xdg
+
+DESCRIPTION="Python bindings for GObject Introspection"
+HOMEPAGE="https://pygobject.readthedocs.io/";
+
+LICENSE="LGPL-2.1+"
+SLOT="3"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 
~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris 
~x64-solaris ~x86-solaris"
+IUSE="+cairo examples test"
+RESTRICT="!test? ( test )"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="${PYTHON_DEPS}
+       >=dev-libs/glib-2.56:2
+       >=dev-libs/gobject-introspection-1.56:=
+       dev-libs/libffi:=
+       cairo? (
+               >=dev-python/pycairo-1.16.0[${PYTHON_USEDEP}]
+               x11-libs/cairo[glib] )
+"
+DEPEND="${RDEPEND}
+       test? (
+               dev-libs/atk[introspection]
+               dev-python/pytest[${PYTHON_USEDEP}]
+               x11-libs/gdk-pixbuf:2[introspection,jpeg]
+               x11-libs/gtk+:3[introspection]
+               x11-libs/pango[introspection]
+       )
+"
+BDEPEND="
+       virtual/pkgconfig
+"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-dynamicimporter-py310.patch
+)
+
+src_configure() {
+       configuring() {
+               meson_src_configure \
+                       $(meson_feature cairo pycairo) \
+                       $(meson_use test tests) \
+                       -Dpython="${EPYTHON}"
+       }
+
+       python_foreach_impl configuring
+}
+
+src_compile() {
+       python_foreach_impl meson_src_compile
+}
+
+src_test() {
+       local -x GIO_USE_VFS="local" # prevents odd issues with deleting 
${T}/.gvfs
+       local -x GIO_USE_VOLUME_MONITOR="unix" # prevent udisks-related 
failures in chroots, bug #449484
+
+       testing() {
+               local -x XDG_CACHE_HOME="${T}/${EPYTHON}"
+               meson_src_test || die "test failed for ${EPYTHON}"
+       }
+       virtx python_foreach_impl testing
+}
+
+src_install() {
+       installing() {
+               meson_src_install
+               python_optimize
+       }
+       python_foreach_impl installing
+       use examples && dodoc -r examples
+}

diff --git a/profiles/package.mask b/profiles/package.mask
index 443bddc227e..be6f5830ad5 100644
--- a/profiles/package.mask
+++ b/profiles/package.mask
@@ -100,6 +100,7 @@ net-libs/libsoup:3.0
 >=net-libs/glib-networking-2.69
 >=dev-libs/gobject-introspection-common-1.69
 >=dev-libs/gobject-introspection-1.69
+>=dev-python/pygobject-3.41
 
 # Ionen Wolkens <[email protected]> (2021-09-12)
 # No reverse dependencies, stuck on EAPI-5.

Reply via email to