Gentoo Archives: gentoo-commits

From: Marek Szuba <marecki@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-gfx/zbar/files/, media-gfx/zbar/
Date: Fri, 04 Jun 2021 11:23:59
Message-Id: 1622805824.7efabb81f9bbfc7ea149285949a27400ea6db736.marecki@gentoo
1 commit: 7efabb81f9bbfc7ea149285949a27400ea6db736
2 Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 4 11:21:30 2021 +0000
4 Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 4 11:23:44 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7efabb81
7
8 media-gfx/zbar: fix python3_9 compilation failure
9
10 Backported upstream fix. Tested against python3_8 and python3_9,
11 compiles fine against both.
12
13 Reported-by: PhobosK <phobosk <AT> fastmail.fm>
14 Closes: https://bugs.gentoo.org/788703
15 Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>
16
17 .../zbar/files/zbar-0.23.1_python_tp_print.patch | 55 ++++++++++++++++++++++
18 media-gfx/zbar/zbar-0.23.1.ebuild | 1 +
19 2 files changed, 56 insertions(+)
20
21 diff --git a/media-gfx/zbar/files/zbar-0.23.1_python_tp_print.patch b/media-gfx/zbar/files/zbar-0.23.1_python_tp_print.patch
22 new file mode 100644
23 index 00000000000..8d4d821426d
24 --- /dev/null
25 +++ b/media-gfx/zbar/files/zbar-0.23.1_python_tp_print.patch
26 @@ -0,0 +1,55 @@
27 +From 938d39716488b545b92c28f48acc94a7b8fc9138 Mon Sep 17 00:00:00 2001
28 +From: Mauro Carvalho Chehab <mchehab+huawei@××××××.org>
29 +Date: Tue, 28 Jul 2020 10:27:30 +0200
30 +Subject: [PATCH] python: enum: make it compatible with Python 3.9
31 +
32 +As reported by:
33 + https://github.com/mchehab/zbar/issues/92
34 +
35 +python bindings don't build with Python 3.9, because it is
36 +using tp_print, which has been silently ignored since Python
37 +3.0, according with[1]:
38 +
39 + "The tp_print slot of PyTypeObject has been removed.
40 + It was used for printing objects to files in Python 2.7
41 + and before.
42 + Since Python 3.0, it has been ignored and unused."
43 +
44 +[1] https://docs.python.org/3.9/whatsnew/3.9.html#id3
45 +
46 +Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@××××××.org>
47 +---
48 + python/enum.c | 5 +++++
49 + 1 file changed, 5 insertions(+)
50 +
51 +diff --git a/python/enum.c b/python/enum.c
52 +index a1135531..dfe1b1ef 100644
53 +--- a/python/enum.c
54 ++++ b/python/enum.c
55 +@@ -76,6 +76,8 @@ enumitem_str (zbarEnumItem *self)
56 + return(self->name);
57 + }
58 +
59 ++#if PY_MAJOR_VERSION < 3
60 ++/* tp_print was dropped on Python 3.9 */
61 + static int
62 + enumitem_print (zbarEnumItem *self,
63 + FILE *fp,
64 +@@ -83,6 +85,7 @@ enumitem_print (zbarEnumItem *self,
65 + {
66 + return(self->name->ob_type->tp_print(self->name, fp, flags));
67 + }
68 ++#endif
69 +
70 + static PyObject*
71 + enumitem_repr (zbarEnumItem *self)
72 +@@ -115,7 +118,9 @@ PyTypeObject zbarEnumItem_Type = {
73 + .tp_new = (newfunc)enumitem_new,
74 + .tp_dealloc = (destructor)enumitem_dealloc,
75 + .tp_str = (reprfunc)enumitem_str,
76 ++#if PY_MAJOR_VERSION < 3
77 + .tp_print = (printfunc)enumitem_print,
78 ++#endif
79 + .tp_repr = (reprfunc)enumitem_repr,
80 + };
81 +
82
83 diff --git a/media-gfx/zbar/zbar-0.23.1.ebuild b/media-gfx/zbar/zbar-0.23.1.ebuild
84 index d74a878a969..7b07b269b68 100644
85 --- a/media-gfx/zbar/zbar-0.23.1.ebuild
86 +++ b/media-gfx/zbar/zbar-0.23.1.ebuild
87 @@ -87,6 +87,7 @@ PATCHES=(
88 "${FILESDIR}/${PN}-0.23_fix_Qt5X11Extras_detect.patch"
89 "${FILESDIR}/${PN}-0.23_fix_python_detect.patch"
90 "${FILESDIR}/${P}-autoconf-2.70.patch"
91 + "${FILESDIR}/${PN}-0.23.1_python_tp_print.patch"
92 )
93
94 DOCS=( README.md NEWS.md TODO.md HACKING.md TODO.md ChangeLog )