From 5e9602acc2bf3e97297e9938165499fd3516be56 Mon Sep 17 00:00:00 2001 From: zhang-liang-pengkun Date: Thu, 26 Oct 2023 16:30:54 +0800 Subject: [PATCH] xcbgen: xml.etree.cElementTree has been dropped in Python 3.9. Signed-off-by: zhang-liang-pengkun --- ....cElementTree-has-been-dropped-in-Py.patch | 56 +++++++++++++++++++ xcb-proto.spec | 7 ++- 2 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 0002-xcbgen-xml.etree.cElementTree-has-been-dropped-in-Py.patch diff --git a/0002-xcbgen-xml.etree.cElementTree-has-been-dropped-in-Py.patch b/0002-xcbgen-xml.etree.cElementTree-has-been-dropped-in-Py.patch new file mode 100644 index 0000000..63926df --- /dev/null +++ b/0002-xcbgen-xml.etree.cElementTree-has-been-dropped-in-Py.patch @@ -0,0 +1,56 @@ +From 7d58eed95f796fc764741d7549ee2214bbbcc64c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= +Date: Mon, 1 Jun 2020 12:29:01 +0200 +Subject: [PATCH] xcbgen: xml.etree.cElementTree has been dropped in Python + 3.9. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It can be replaced with xml.etree.ElementTree safely. + +Signed-off-by: Björn Esser +--- + xcbgen/matcher.py | 7 ++++++- + xcbgen/state.py | 7 ++++++- + 2 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/xcbgen/matcher.py b/xcbgen/matcher.py +index 97a8b43..a13ef28 100644 +--- a/xcbgen/matcher.py ++++ b/xcbgen/matcher.py +@@ -7,7 +7,12 @@ we do not create a new type object, we just record the existing one under a new + ''' + + from os.path import join +-from xml.etree.cElementTree import parse ++from sys import version_info ++ ++if version_info[:2] >= (3, 9): ++ from xml.etree.ElementTree import parse ++else: ++ from xml.etree.cElementTree import parse + + from xcbgen.xtypes import * + +diff --git a/xcbgen/state.py b/xcbgen/state.py +index 0dbecdc..3b7eeb4 100644 +--- a/xcbgen/state.py ++++ b/xcbgen/state.py +@@ -2,7 +2,12 @@ + This module contains the namespace class and the singleton module class. + ''' + from os.path import dirname, basename +-from xml.etree.cElementTree import parse ++from sys import version_info ++ ++if version_info[:2] >= (3, 9): ++ from xml.etree.ElementTree import parse ++else: ++ from xml.etree.cElementTree import parse + + from xcbgen import matcher + from xcbgen.error import * +-- +2.39.0.windows.2 + diff --git a/xcb-proto.spec b/xcb-proto.spec index cab1272..dea0d15 100644 --- a/xcb-proto.spec +++ b/xcb-proto.spec @@ -1,14 +1,14 @@ %define debug_package %{nil} Name: xcb-proto Version: 1.14 -Release: 3 +Release: 4 Summary: XCB protocol descriptions License: MIT URL: https://xcb.freedesktop.org/ Source0: https://xcb.freedesktop.org/dist/%{name}-%{version}.tar.gz Patch01: 0001-Parse-a-field-s-enum-correctly.patch Patch6000: backport-fixes-for-python-3.9.patch - +Patch6001: 0002-xcbgen-xml.etree.cElementTree-has-been-dropped-in-Py.patch BuildArch: noarch BuildRequires: python3-devel @@ -39,6 +39,9 @@ export PYTHON="python3" %{python3_sitelib}/xcbgen %changelog +* Thu Oct 26 2023 zhangliangpengkun - 1.14-4 +- xcbgen: xml.etree.cElementTree has been dropped in Python 3.9. + * Thu Oct 12 2023 zhangliangpengkun - 1.14-3 - Parse a field's "enum=" correctly -- Gitee