Gentoo Archives: gentoo-commits

From: Mart Raudsepp <leio@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: profiles/, dev-python/pygobject/, dev-python/pygobject/files/
Date: Wed, 22 Sep 2021 07:46:08
Message-Id: 1632296709.54666dc853bb782e452e46be1e00c4a70a897b27.leio@gentoo
1 commit: 54666dc853bb782e452e46be1e00c4a70a897b27
2 Author: Mart Raudsepp <leio <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 22 07:21:53 2021 +0000
4 Commit: Mart Raudsepp <leio <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 22 07:45:09 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=54666dc8
7
8 dev-python/pygobject: bump to 3.42.0
9
10 The py3.10 patch is updated to upstreamed variant.
11
12 Package-Manager: Portage-3.0.20, Repoman-3.0.2
13 Signed-off-by: Mart Raudsepp <leio <AT> gentoo.org>
14
15 dev-python/pygobject/Manifest | 1 +
16 .../pygobject-3.42.0-dynamicimporter-py310.patch | 61 +++++++++++++++++
17 dev-python/pygobject/pygobject-3.42.0.ebuild | 78 ++++++++++++++++++++++
18 profiles/package.mask | 1 +
19 4 files changed, 141 insertions(+)
20
21 diff --git a/dev-python/pygobject/Manifest b/dev-python/pygobject/Manifest
22 index 20597c1fe1e..cccbe5e376b 100644
23 --- a/dev-python/pygobject/Manifest
24 +++ b/dev-python/pygobject/Manifest
25 @@ -1 +1,2 @@
26 DIST pygobject-3.40.1.tar.xz 556104 BLAKE2B e6a092bee68121d9ef82f41f21c9811f384b8578c48de445f707f1b0de124cf38d899d34b8f4269a154ebd4e323afdfa7afef5c0c5cc5dc451b2cd68b30da04b SHA512 a8350f43ea99c93aa66a23102d4ee2ca3c7f8ec2c8bcf5cd142dd097b4fb38167f1713efff3584aa323c34656c911fb940e462c83c02b107e4aad93d005022f7
27 +DIST pygobject-3.42.0.tar.xz 557060 BLAKE2B 25c0634dcb713f4059d19ff2efdd67004e1343f49982123686f4df71fc2678583244dab7a22160f42d5361c3e5c6e38bcd8ccaeeafb3e1d885e5d5febaa9dde1 SHA512 2f3e9187cb8dd7ccbf139a58ea348732fc7cb95dbf4bee2ba8f78003a7540d90c0b29153d93f50bf613c2d43f0de0ec8971c61c358d48552e42ce17775a178dd
28
29 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
30 new file mode 100644
31 index 00000000000..cf292ffbf7c
32 --- /dev/null
33 +++ b/dev-python/pygobject/files/pygobject-3.42.0-dynamicimporter-py310.patch
34 @@ -0,0 +1,61 @@
35 +From dea457c0754550e210ab3cca9da8be1ae52d1d31 Mon Sep 17 00:00:00 2001
36 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@×××××××.cz>
37 +Date: Tue, 18 May 2021 12:31:51 +0200
38 +Subject: [PATCH] Implement DynamicImporter.find_spec()
39 +
40 +On Python 3.10, the code raised an ImportWarning:
41 +
42 + ImportWarning: DynamicImporter.find_spec() not found; falling back to find_module()
43 +
44 +See https://docs.python.org/3.10/whatsnew/3.10.html#deprecated
45 +
46 +> Starting in this release, there will be a concerted effort to begin cleaning
47 +> up old import semantics that were kept for Python 2.7 compatibility.
48 +> Specifically, find_loader()/find_module() (superseded by find_spec()),
49 +> load_module() (superseded by exec_module()), module_repr()
50 +> (which the import system takes care of for you),
51 +> the __package__ attribute (superseded by __spec__.parent),
52 +> the __loader__ attribute (superseded by __spec__.loader),
53 +> and the __cached__ attribute (superseded by __spec__.cached)
54 +> will slowly be removed (as well as other classes and methods in importlib).
55 +> ImportWarning and/or DeprecationWarning will be raised as appropriate to help
56 +> identify code which needs updating during this transition.
57 +
58 +Fixes https://gitlab.gnome.org/GNOME/pygobject/-/issues/473
59 +---
60 + gi/importer.py | 15 ++++++++++-----
61 + 1 file changed, 10 insertions(+), 5 deletions(-)
62 +
63 +diff --git a/gi/importer.py b/gi/importer.py
64 +index 32967974..63788776 100644
65 +--- a/gi/importer.py
66 ++++ b/gi/importer.py
67 +@@ -107,15 +107,20 @@ class DynamicImporter(object):
68 + def __init__(self, path):
69 + self.path = path
70 +
71 +- def find_module(self, fullname, path=None):
72 ++ def _find_module_check(self, fullname):
73 + if not fullname.startswith(self.path):
74 +- return
75 ++ return False
76 +
77 + path, namespace = fullname.rsplit('.', 1)
78 +- if path != self.path:
79 +- return
80 ++ return path == self.path
81 ++
82 ++ def find_spec(self, fullname, path=None, target=None):
83 ++ if self._find_module_check(fullname):
84 ++ return importlib.util.spec_from_loader(fullname, self)
85 +
86 +- return self
87 ++ def find_module(self, fullname, path=None):
88 ++ if self._find_module_check(fullname):
89 ++ return self
90 +
91 + def load_module(self, fullname):
92 + if fullname in sys.modules:
93 +--
94 +2.32.0
95 +
96
97 diff --git a/dev-python/pygobject/pygobject-3.42.0.ebuild b/dev-python/pygobject/pygobject-3.42.0.ebuild
98 new file mode 100644
99 index 00000000000..01f7b7055eb
100 --- /dev/null
101 +++ b/dev-python/pygobject/pygobject-3.42.0.ebuild
102 @@ -0,0 +1,78 @@
103 +# Copyright 1999-2021 Gentoo Authors
104 +# Distributed under the terms of the GNU General Public License v2
105 +
106 +EAPI=7
107 +
108 +PYTHON_COMPAT=( python3_{7..10} )
109 +
110 +inherit gnome.org meson python-r1 virtualx xdg
111 +
112 +DESCRIPTION="Python bindings for GObject Introspection"
113 +HOMEPAGE="https://pygobject.readthedocs.io/"
114 +
115 +LICENSE="LGPL-2.1+"
116 +SLOT="3"
117 +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"
118 +IUSE="+cairo examples test"
119 +RESTRICT="!test? ( test )"
120 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
121 +
122 +RDEPEND="${PYTHON_DEPS}
123 + >=dev-libs/glib-2.56:2
124 + >=dev-libs/gobject-introspection-1.56:=
125 + dev-libs/libffi:=
126 + cairo? (
127 + >=dev-python/pycairo-1.16.0[${PYTHON_USEDEP}]
128 + x11-libs/cairo[glib] )
129 +"
130 +DEPEND="${RDEPEND}
131 + test? (
132 + dev-libs/atk[introspection]
133 + dev-python/pytest[${PYTHON_USEDEP}]
134 + x11-libs/gdk-pixbuf:2[introspection,jpeg]
135 + x11-libs/gtk+:3[introspection]
136 + x11-libs/pango[introspection]
137 + )
138 +"
139 +BDEPEND="
140 + virtual/pkgconfig
141 +"
142 +
143 +PATCHES=(
144 + "${FILESDIR}"/${P}-dynamicimporter-py310.patch
145 +)
146 +
147 +src_configure() {
148 + configuring() {
149 + meson_src_configure \
150 + $(meson_feature cairo pycairo) \
151 + $(meson_use test tests) \
152 + -Dpython="${EPYTHON}"
153 + }
154 +
155 + python_foreach_impl configuring
156 +}
157 +
158 +src_compile() {
159 + python_foreach_impl meson_src_compile
160 +}
161 +
162 +src_test() {
163 + local -x GIO_USE_VFS="local" # prevents odd issues with deleting ${T}/.gvfs
164 + local -x GIO_USE_VOLUME_MONITOR="unix" # prevent udisks-related failures in chroots, bug #449484
165 +
166 + testing() {
167 + local -x XDG_CACHE_HOME="${T}/${EPYTHON}"
168 + meson_src_test || die "test failed for ${EPYTHON}"
169 + }
170 + virtx python_foreach_impl testing
171 +}
172 +
173 +src_install() {
174 + installing() {
175 + meson_src_install
176 + python_optimize
177 + }
178 + python_foreach_impl installing
179 + use examples && dodoc -r examples
180 +}
181
182 diff --git a/profiles/package.mask b/profiles/package.mask
183 index 443bddc227e..be6f5830ad5 100644
184 --- a/profiles/package.mask
185 +++ b/profiles/package.mask
186 @@ -100,6 +100,7 @@ net-libs/libsoup:3.0
187 >=net-libs/glib-networking-2.69
188 >=dev-libs/gobject-introspection-common-1.69
189 >=dev-libs/gobject-introspection-1.69
190 +>=dev-python/pygobject-3.41
191
192 # Ionen Wolkens <ionen@g.o> (2021-09-12)
193 # No reverse dependencies, stuck on EAPI-5.