Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-admin/system-config-printer/files/, app-admin/system-config-printer/
Date: Sun, 25 Oct 2020 00:28:03
Message-Id: 1603585659.14a30e74032de0399de3e8ffefbf04c2316070a5.asturm@gentoo
1 commit: 14a30e74032de0399de3e8ffefbf04c2316070a5
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 24 16:15:53 2020 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 25 00:27:39 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=14a30e74
7
8 app-admin/system-config-printer: python3_9 w/ required fixes
9
10 Package-Manager: Portage-3.0.8, Repoman-3.0.2
11 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
12
13 ...config-printer-1.5.12-catch-urllib-errors.patch | 22 +++
14 ...config-printer-1.5.12-fix-remember-passwd.patch | 121 +++++++++++++++++
15 .../system-config-printer-1.5.12-py39-1.patch | 45 +++++++
16 .../system-config-printer-1.5.12-py39-2.patch | 147 +++++++++++++++++++++
17 .../system-config-printer-1.5.12-r2.ebuild | 86 ++++++++++++
18 5 files changed, 421 insertions(+)
19
20 diff --git a/app-admin/system-config-printer/files/system-config-printer-1.5.12-catch-urllib-errors.patch b/app-admin/system-config-printer/files/system-config-printer-1.5.12-catch-urllib-errors.patch
21 new file mode 100644
22 index 00000000000..fbae8442615
23 --- /dev/null
24 +++ b/app-admin/system-config-printer/files/system-config-printer-1.5.12-catch-urllib-errors.patch
25 @@ -0,0 +1,22 @@
26 +From feed693225cc0c26464bfc0adef21da72581e811 Mon Sep 17 00:00:00 2001
27 +From: Zdenek Dohnal <zdohnal@××××××.com>
28 +Date: Thu, 28 Nov 2019 15:45:22 +0100
29 +Subject: [PATCH] Catch errors from urllib too
30 +
31 +---
32 + newprinter.py | 2 +-
33 + 1 file changed, 1 insertion(+), 1 deletion(-)
34 +
35 +diff --git a/newprinter.py b/newprinter.py
36 +index 8b9298887..6c71ec578 100644
37 +--- a/newprinter.py
38 ++++ b/newprinter.py
39 +@@ -4183,7 +4183,7 @@ def getNPPPD(self):
40 + tmpf.flush ()
41 + ppd = cups.PPD(tmpf.name)
42 +
43 +- except RuntimeError as e:
44 ++ except (RuntimeError, urllib.error.HTTPError) as e:
45 + debugprint ("RuntimeError: " + repr (e))
46 + if self.rbtnNPFoomatic.get_active():
47 + # Foomatic database problem of some sort.
48
49 diff --git a/app-admin/system-config-printer/files/system-config-printer-1.5.12-fix-remember-passwd.patch b/app-admin/system-config-printer/files/system-config-printer-1.5.12-fix-remember-passwd.patch
50 new file mode 100644
51 index 00000000000..980d1e03154
52 --- /dev/null
53 +++ b/app-admin/system-config-printer/files/system-config-printer-1.5.12-fix-remember-passwd.patch
54 @@ -0,0 +1,121 @@
55 +From b74c701feb52a1d2865fe1d33c393f71ae3ac47a Mon Sep 17 00:00:00 2001
56 +From: Ave Ozkal <ave@×××.zone>
57 +Date: Thu, 19 Mar 2020 13:30:23 +0300
58 +Subject: [PATCH 1/3] jobviewer: Use sync methods for secret.service
59 +
60 +---
61 + jobviewer.py | 28 +++++++++-------------------
62 + 1 file changed, 9 insertions(+), 19 deletions(-)
63 +
64 +diff --git a/jobviewer.py b/jobviewer.py
65 +index b95bf6c58..ba8abd06f 100644
66 +--- a/jobviewer.py
67 ++++ b/jobviewer.py
68 +@@ -91,36 +91,26 @@
69 + class ServiceGet:
70 + service = Secret.Service()
71 +
72 +- def on_get_service(self, source, result, unused):
73 +- service = Secret.Service.get_finish(result)
74 +-
75 + def __init__(self):
76 +- Secret.Service.get(0,
77 +- None,
78 +- self.on_get_service,
79 +- None)
80 ++ self.service = Secret.Service.get(0,
81 ++ None)
82 +
83 + def get_service(self):
84 +- return ServiceGet.service
85 ++ return self.service
86 +
87 +
88 + class ItemSearch:
89 + items = list()
90 +
91 +- def on_search_item(self, source, result, unused):
92 +- items = Secret.Service.search_finish(None, result)
93 +-
94 + def __init__(self, service, attrs):
95 +- Secret.Service.search(service,
96 +- NETWORK_PASSWORD,
97 +- attrs,
98 +- Secret.SearchFlags.LOAD_SECRETS,
99 +- None,
100 +- self.on_search_item,
101 +- None)
102 ++ self.items = Secret.Service.search_sync(service,
103 ++ NETWORK_PASSWORD,
104 ++ attrs,
105 ++ Secret.SearchFlags.LOAD_SECRETS,
106 ++ None)
107 +
108 + def get_items(self):
109 +- return ItemSearch.items
110 ++ return self.items
111 +
112 +
113 + class PasswordStore:
114 +
115 +From 152b617f511cd44757d2db4d730067aca8cf69a9 Mon Sep 17 00:00:00 2001
116 +From: Ave Ozkal <ave@×××.zone>
117 +Date: Thu, 19 Mar 2020 14:39:21 +0300
118 +Subject: [PATCH 2/3] jobviewer: properly use sync
119 +
120 +---
121 + jobviewer.py | 4 ++--
122 + 1 file changed, 2 insertions(+), 2 deletions(-)
123 +
124 +diff --git a/jobviewer.py b/jobviewer.py
125 +index ba8abd06f..761673b49 100644
126 +--- a/jobviewer.py
127 ++++ b/jobviewer.py
128 +@@ -92,8 +92,8 @@ class ServiceGet:
129 + service = Secret.Service()
130 +
131 + def __init__(self):
132 +- self.service = Secret.Service.get(0,
133 +- None)
134 ++ self.service = Secret.Service.get_sync(0,
135 ++ None)
136 +
137 + def get_service(self):
138 + return self.service
139 +
140 +From 00177768ca1464c694acde4cdbabc1a18420c176 Mon Sep 17 00:00:00 2001
141 +From: Ave Ozkal <ave@×××.zone>
142 +Date: Thu, 19 Mar 2020 14:40:55 +0300
143 +Subject: [PATCH 3/3] jobviewer: Properly fetch username and password
144 +
145 +---
146 + jobviewer.py | 14 ++------------
147 + 1 file changed, 2 insertions(+), 12 deletions(-)
148 +
149 +diff --git a/jobviewer.py b/jobviewer.py
150 +index 761673b49..5376a7e88 100644
151 +--- a/jobviewer.py
152 ++++ b/jobviewer.py
153 +@@ -1049,20 +1049,10 @@ def get_authentication (self, job, device_uri, printer_uri,
154 + if items:
155 + auth_info = ['' for x in auth_info_required]
156 + ind = auth_info_required.index ('username')
157 +-
158 +- for attr in items[0].attributes:
159 +- # It might be safe to assume here that the
160 +- # user element is always the second item in a
161 +- # NETWORK_PASSWORD element but lets make sure.
162 +- if attr.name == 'user':
163 +- auth_info[ind] = attr.get_string()
164 +- break
165 +- else:
166 +- debugprint ("Did not find username keyring "
167 +- "attributes.")
168 ++ auth_info[ind] = items[0].get_attributes().get("user")
169 +
170 + ind = auth_info_required.index ('password')
171 +- auth_info[ind] = items[0].secret
172 ++ auth_info[ind] = items[0].get_secret().get().decode()
173 + break
174 + else:
175 + debugprint ("Failed to find secret in keyring.")
176
177 diff --git a/app-admin/system-config-printer/files/system-config-printer-1.5.12-py39-1.patch b/app-admin/system-config-printer/files/system-config-printer-1.5.12-py39-1.patch
178 new file mode 100644
179 index 00000000000..658a63d65c7
180 --- /dev/null
181 +++ b/app-admin/system-config-printer/files/system-config-printer-1.5.12-py39-1.patch
182 @@ -0,0 +1,45 @@
183 +From cf7a74217558b19aff7c21a724878bcc15dc4e38 Mon Sep 17 00:00:00 2001
184 +From: Zdenek Dohnal <zdohnal@××××××.com>
185 +Date: Mon, 5 Oct 2020 09:26:40 +0200
186 +Subject: [PATCH] isAlive() is removed, use is_alive()
187 +
188 +---
189 + asyncipp.py | 2 +-
190 + timedops.py | 4 ++--
191 + 2 files changed, 3 insertions(+), 3 deletions(-)
192 +
193 +diff --git a/asyncipp.py b/asyncipp.py
194 +index 5bc160e0f..61cd72136 100644
195 +--- a/asyncipp.py
196 ++++ b/asyncipp.py
197 +@@ -269,7 +269,7 @@ def destroy (self):
198 + for binding in self.bindings:
199 + delattr (self, binding)
200 +
201 +- if self.thread.isAlive ():
202 ++ if self.thread.is_alive ():
203 + debugprint ("Stopping worker thread")
204 + self.thread.stop ()
205 + GLib.timeout_add_seconds (1, self._reap_thread)
206 +diff --git a/timedops.py b/timedops.py
207 +index 8a8741c82..111d575f6 100644
208 +--- a/timedops.py
209 ++++ b/timedops.py
210 +@@ -157,7 +157,7 @@ def run (self):
211 + self.exception = e
212 +
213 + def collect_result (self):
214 +- if self.isAlive ():
215 ++ if self.is_alive ():
216 + # We've been canceled.
217 + raise OperationCanceled()
218 +
219 +@@ -212,7 +212,7 @@ def run (self):
220 + return self.thread.collect_result ()
221 +
222 + def _check_thread (self):
223 +- if self.thread.isAlive ():
224 ++ if self.thread.is_alive ():
225 + # Thread still running.
226 + return True
227 +
228
229 diff --git a/app-admin/system-config-printer/files/system-config-printer-1.5.12-py39-2.patch b/app-admin/system-config-printer/files/system-config-printer-1.5.12-py39-2.patch
230 new file mode 100644
231 index 00000000000..eccb3939e0d
232 --- /dev/null
233 +++ b/app-admin/system-config-printer/files/system-config-printer-1.5.12-py39-2.patch
234 @@ -0,0 +1,147 @@
235 +From 63eccd5603e19cd35d6d44af65443665a3c63f38 Mon Sep 17 00:00:00 2001
236 +From: Zdenek Dohnal <zdohnal@××××××.com>
237 +Date: Wed, 22 Jul 2020 13:57:13 +0200
238 +Subject: [PATCH] python3.9 - xml module removed elem.getchildren() method, use
239 + list(elem)
240 +
241 +---
242 + cupshelpers/openprinting.py | 6 +++---
243 + cupshelpers/xmldriverprefs.py | 20 ++++++++++----------
244 + xml/validate.py | 10 +++++-----
245 + 3 files changed, 18 insertions(+), 18 deletions(-)
246 +
247 +diff --git a/cupshelpers/openprinting.py b/cupshelpers/openprinting.py
248 +index c616d913c..9bb4764c9 100755
249 +--- a/cupshelpers/openprinting.py
250 ++++ b/cupshelpers/openprinting.py
251 +@@ -338,7 +338,7 @@ def parse_result (status, data, result):
252 + packages = {}
253 + container = driver.find ('packages')
254 + if container is not None:
255 +- for arch in container.getchildren ():
256 ++ for arch in list(container):
257 + rpms = {}
258 + for package in arch.findall ('package'):
259 + rpm = {}
260 +@@ -351,7 +351,7 @@ def parse_result (status, data, result):
261 +
262 + repositories = package.find ('repositories')
263 + if repositories is not None:
264 +- for pkgsys in repositories.getchildren ():
265 ++ for pkgsys in list(repositories):
266 + rpm.setdefault('repositories', {})[pkgsys.tag] = pkgsys.text
267 +
268 + rpms[package.attrib['file']] = rpm
269 +@@ -363,7 +363,7 @@ def parse_result (status, data, result):
270 + ppds = []
271 + container = driver.find ('ppds')
272 + if container is not None:
273 +- for each in container.getchildren ():
274 ++ for each in list(container):
275 + ppds.append (each.text)
276 +
277 + if ppds:
278 +diff --git a/cupshelpers/xmldriverprefs.py b/cupshelpers/xmldriverprefs.py
279 +index 4177e1c0f..0d02950f4 100644
280 +--- a/cupshelpers/xmldriverprefs.py
281 ++++ b/cupshelpers/xmldriverprefs.py
282 +@@ -27,7 +27,7 @@
283 +
284 + def PreferredDrivers (filename):
285 + preferreddrivers = xml.etree.ElementTree.XML (open (filename).read ())
286 +- return preferreddrivers.getchildren()
287 ++ return list(preferreddrivers)
288 +
289 + class DeviceIDMatch:
290 + """
291 +@@ -227,10 +227,10 @@ def load (self, drivertypes):
292 + """
293 +
294 + types = []
295 +- for drivertype in drivertypes.getchildren ():
296 ++ for drivertype in list(drivertypes):
297 + t = DriverType (drivertype.attrib["name"])
298 +
299 +- for child in drivertype.getchildren ():
300 ++ for child in list(drivertype):
301 + if child.tag == "ppdname":
302 + t.add_ppd_name (child.attrib["match"])
303 + elif child.tag == "attribute":
304 +@@ -238,7 +238,7 @@ def load (self, drivertypes):
305 + child.attrib["match"])
306 + elif child.tag == "deviceid":
307 + deviceid_match = DeviceIDMatch ()
308 +- for field in child.getchildren ():
309 ++ for field in list(child):
310 + if field.tag == "field":
311 + deviceid_match.add_field (field.attrib["name"],
312 + field.attrib["match"])
313 +@@ -414,29 +414,29 @@ def load (self, preferreddrivers):
314 + Load the policy from an XML file.
315 + """
316 +
317 +- for printer in preferreddrivers.getchildren ():
318 ++ for printer in list(preferreddrivers):
319 + ptype = PrinterType ()
320 +- for child in printer.getchildren ():
321 ++ for child in list(printer):
322 + if child.tag == "make-and-model":
323 + ptype.add_make_and_model (child.attrib["match"])
324 + elif child.tag == "deviceid":
325 + deviceid_match = DeviceIDMatch ()
326 +- for field in child.getchildren ():
327 ++ for field in list(child):
328 + if field.tag == "field":
329 + deviceid_match.add_field (field.attrib["name"],
330 + field.attrib["match"])
331 + ptype.add_deviceid_match (deviceid_match)
332 +
333 + elif child.tag == "drivers":
334 +- for drivertype in child.getchildren ():
335 ++ for drivertype in list(child):
336 + ptype.add_drivertype_pattern (drivertype.text)
337 +
338 + elif child.tag == "avoid":
339 +- for drivertype in child.getchildren ():
340 ++ for drivertype in list(child):
341 + ptype.add_avoidtype_pattern (drivertype.text)
342 +
343 + elif child.tag == "blacklist":
344 +- for drivertype in child.getchildren ():
345 ++ for drivertype in list(child):
346 + ptype.add_blacklisted (drivertype.text)
347 +
348 + self.ptypes.append (ptype)
349 +diff --git a/xml/validate.py b/xml/validate.py
350 +index 8fc201ecf..ba16766dc 100644
351 +--- a/xml/validate.py
352 ++++ b/xml/validate.py
353 +@@ -35,23 +35,23 @@ def validate (self):
354 + filename = self._filename
355 + print ("Validating %s" % filename)
356 + preferreddrivers = xml.etree.ElementTree.XML (open (filename).read ())
357 +- (drivertypes, preferenceorder) = preferreddrivers.getchildren ()
358 ++ (drivertypes, preferenceorder) = list(preferreddrivers)
359 + validates = True
360 +
361 + names = set()
362 +- for drivertype in drivertypes.getchildren ():
363 ++ for drivertype in list(drivertypes):
364 + name = drivertype.get ("name")
365 + names.add (name)
366 +
367 +- for printer in preferenceorder.getchildren ():
368 ++ for printer in list(preferenceorder):
369 + types = []
370 + drivers = printer.find ("drivers")
371 + if drivers is not None:
372 +- types.extend (drivers.getchildren ())
373 ++ types.extend (list(drivers))
374 +
375 + blacklist = printer.find ("blacklist")
376 + if blacklist is not None:
377 +- types.extend (blacklist.getchildren ())
378 ++ types.extend (list(blacklist))
379 +
380 + for drivertype in types:
381 + pattern = drivertype.text.strip ()
382
383 diff --git a/app-admin/system-config-printer/system-config-printer-1.5.12-r2.ebuild b/app-admin/system-config-printer/system-config-printer-1.5.12-r2.ebuild
384 new file mode 100644
385 index 00000000000..c97eaf9b4f2
386 --- /dev/null
387 +++ b/app-admin/system-config-printer/system-config-printer-1.5.12-r2.ebuild
388 @@ -0,0 +1,86 @@
389 +# Copyright 1999-2020 Gentoo Authors
390 +# Distributed under the terms of the GNU General Public License v2
391 +
392 +EAPI=6
393 +
394 +PYTHON_COMPAT=( python3_{7,8,9} )
395 +PYTHON_REQ_USE="xml"
396 +inherit gnome2 python-single-r1 systemd
397 +
398 +DESCRIPTION="Graphical user interface for CUPS administration"
399 +HOMEPAGE="https://github.com/OpenPrinting/system-config-printer"
400 +SRC_URI="https://github.com/OpenPrinting/${PN}/releases/download/${PV}/${P}.tar.xz"
401 +
402 +LICENSE="GPL-2+"
403 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~sparc ~x86"
404 +SLOT="0"
405 +IUSE="gnome-keyring policykit"
406 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
407 +
408 +# Needs cups running, bug 284005
409 +RESTRICT="test"
410 +
411 +# Additional unhandled dependencies
412 +# gnome-extra/gnome-packagekit[${PYTHON_USEDEP}] with pygobject:2 ?
413 +# python samba client: smbc
414 +# selinux: needed for troubleshooting
415 +COMMON_DEPEND="${PYTHON_DEPS}
416 + dev-libs/glib:2
417 + net-print/cups[dbus]
418 + virtual/libusb:1
419 + >=virtual/udev-172
420 + x11-libs/gtk+:3[introspection]
421 + x11-libs/libnotify[introspection]
422 + x11-libs/pango[introspection]
423 +"
424 +DEPEND="${COMMON_DEPEND}
425 + app-text/docbook-xml-dtd:4.1.2
426 + >=app-text/xmlto-0.0.22
427 + dev-perl/XML-Parser
428 + dev-util/desktop-file-utils
429 + dev-util/intltool
430 + sys-devel/gettext
431 + virtual/pkgconfig
432 +"
433 +RDEPEND="${COMMON_DEPEND}
434 + $(python_gen_cond_dep '
435 + dev-python/dbus-python[${PYTHON_MULTI_USEDEP}]
436 + dev-python/pycairo[${PYTHON_MULTI_USEDEP}]
437 + dev-python/pycups[${PYTHON_MULTI_USEDEP}]
438 + dev-python/pygobject:3[${PYTHON_MULTI_USEDEP}]
439 + dev-python/requests[${PYTHON_MULTI_USEDEP}]
440 + dev-python/urllib3[${PYTHON_MULTI_USEDEP}]
441 + ')
442 + gnome-keyring? ( app-crypt/libsecret[introspection] )
443 + policykit? ( net-print/cups-pk-helper )
444 +"
445 +
446 +PATCHES=(
447 + "${FILESDIR}"/${P}-check-for-null.patch
448 + "${FILESDIR}"/${P}-fix-abrt-in-udev-configure-printer.patch
449 + "${FILESDIR}"/${P}-catch-urllib-errors.patch
450 + "${FILESDIR}"/${P}-fix-remember-passwd.patch
451 + "${FILESDIR}"/${P}-py39-{1,2}.patch
452 +)
453 +
454 +pkg_setup() {
455 + python-single-r1_pkg_setup
456 +}
457 +
458 +src_configure() {
459 + gnome2_src_configure \
460 + --enable-nls \
461 + --with-desktop-vendor=Gentoo \
462 + --with-udev-rules \
463 + --with-systemdsystemunitdir=$(systemd_get_systemunitdir)
464 +}
465 +
466 +src_compile() {
467 + gnome2_src_compile
468 +}
469 +
470 +src_install() {
471 + gnome2_src_install
472 + python_fix_shebang "${ED}"
473 + python_optimize
474 +}