From 7028aee63e80bfa8fb53de4513e3e982460f93d3 Mon Sep 17 00:00:00 2001 From: Jan Palus Date: Wed, 30 Oct 2019 00:54:35 +0100 Subject: [PATCH] upstream patch to fix build against python 3.8; rel 4 --- python-pycairo.spec | 4 +++- python3.8.patch | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 python3.8.patch diff --git a/python-pycairo.spec b/python-pycairo.spec index fd22584..3168b83 100644 --- a/python-pycairo.spec +++ b/python-pycairo.spec @@ -10,11 +10,12 @@ Summary: Python 2 Cairo bindings Summary(pl.UTF-8): Dowiązania Pythona 2 dla Cairo Name: python-%{module} Version: 1.16.3 -Release: 3 +Release: 4 License: LGPL v2.1 or MPL v1.1 Group: Libraries/Python Source0: https://github.com/pygobject/pycairo/releases/download/v%{version}/%{module}-%{version}.tar.gz # Source0-md5: d2a115037ccd128219f43d5ed3df7926 +Patch0: python3.8.patch URL: http://cairographics.org/ BuildRequires: cairo-devel >= 1.13.1 BuildRequires: pkgconfig @@ -125,6 +126,7 @@ Przykładowe programy w Pythonie używające Cairo. %prep %setup -q -n pycairo-%{version} +%patch0 -p1 %build %if %{with python2} diff --git a/python3.8.patch b/python3.8.patch new file mode 100644 index 0000000..c3831f5 --- /dev/null +++ b/python3.8.patch @@ -0,0 +1,26 @@ +From 71c81741495cdce132b6f45a0f596d70909c1e4d Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Sat, 15 Jun 2019 16:07:00 +0200 +Subject: [PATCH] enum: explicitely set enum.__str__ + +Python 3.8 has removed the int.__str__ implementation. So we don't fall +back to object.__str__ and thus enum.__repr__ set __str__ to int.__repr__ +instead. This gives us the same behaviour with all python versions. + +See https://github.com/python/cpython/commit/96aeaec64738b730 +--- + cairo/enums.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/cairo/enums.c b/cairo/enums.c +index 08fbaf3..4273232 100644 +--- a/cairo/enums.c ++++ b/cairo/enums.c +@@ -257,6 +257,7 @@ init_enums (PyObject *module) { + PyObject *ev; + + Pycairo_IntEnum_Type.tp_repr = (reprfunc)int_enum_repr; ++ Pycairo_IntEnum_Type.tp_str = PYCAIRO_PyLong_Type.tp_repr; + Pycairo_IntEnum_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; + Pycairo_IntEnum_Type.tp_methods = int_enum_methods; + Pycairo_IntEnum_Type.tp_base = &PYCAIRO_PyLong_Type; -- 2.43.0