void-packages/srcpkgs/zbar/patches/python-3.9.patch
Đoàn Trần Công Danh e2a21ccfd6 srcpkgs/z*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

55 lines
1.6 KiB
Diff

From 938d39716488b545b92c28f48acc94a7b8fc9138 Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Date: Tue, 28 Jul 2020 10:27:30 +0200
Subject: [PATCH] python: enum: make it compatible with Python 3.9
As reported by:
https://github.com/mchehab/zbar/issues/92
python bindings don't build with Python 3.9, because it is
using tp_print, which has been silently ignored since Python
3.0, according with[1]:
"The tp_print slot of PyTypeObject has been removed.
It was used for printing objects to files in Python 2.7
and before.
Since Python 3.0, it has been ignored and unused."
[1] https://docs.python.org/3.9/whatsnew/3.9.html#id3
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
python/enum.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git python/enum.c python/enum.c
index a113553..dfe1b1e 100644
--- a/python/enum.c
+++ b/python/enum.c
@@ -76,6 +76,8 @@ enumitem_str (zbarEnumItem *self)
return(self->name);
}
+#if PY_MAJOR_VERSION < 3
+/* tp_print was dropped on Python 3.9 */
static int
enumitem_print (zbarEnumItem *self,
FILE *fp,
@@ -83,6 +85,7 @@ enumitem_print (zbarEnumItem *self,
{
return(self->name->ob_type->tp_print(self->name, fp, flags));
}
+#endif
static PyObject*
enumitem_repr (zbarEnumItem *self)
@@ -115,7 +118,9 @@ PyTypeObject zbarEnumItem_Type = {
.tp_new = (newfunc)enumitem_new,
.tp_dealloc = (destructor)enumitem_dealloc,
.tp_str = (reprfunc)enumitem_str,
+#if PY_MAJOR_VERSION < 3
.tp_print = (printfunc)enumitem_print,
+#endif
.tp_repr = (reprfunc)enumitem_repr,
};