Backport another fix for compatibility with Python 3.10 (#2023682)

This commit is contained in:
Kalev Lember 2021-11-16 17:16:26 +01:00
parent ad73b1fc65
commit 328f7219cf
2 changed files with 54 additions and 1 deletions

46
121.patch Normal file
View File

@ -0,0 +1,46 @@
From cea2bebdbd9fd69561945d191d9d44beeef655cc Mon Sep 17 00:00:00 2001
From: Valentin Villenave <valentin@villenave.net>
Date: Mon, 15 Nov 2021 14:45:02 +0100
Subject: [PATCH] modify collections module import for Python3.10 compatibility
---
src/orca/generator.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/orca/generator.py b/src/orca/generator.py
index 2058a436d..a7ff8f856 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -27,7 +27,6 @@ __copyright__ = "Copyright (c) 2009 Sun Microsystems Inc." \
"Copyright (c) 2015-2016 Igalia, S.L."
__license__ = "LGPL"
-import collections
import pyatspi
import sys
import time
@@ -41,6 +40,12 @@ from . import object_properties
from . import settings
from . import settings_manager
+# Python 3.10 compatibility:
+try:
+ import collections.abc as collections_abc
+except ImportError:
+ import collections as collections_abc
+
def _formatExceptionInfo(maxTBlevel=5):
cla, exc, trbk = sys.exc_info()
excName = cla.__name__
@@ -78,7 +83,7 @@ class Generator:
self._activeProgressBars = {}
self._methodsDict = {}
for method in \
- [z for z in [getattr(self, y).__get__(self, self.__class__) for y in [x for x in dir(self) if x.startswith(METHOD_PREFIX)]] if isinstance(z, collections.abc.Callable)]:
+ [z for z in [getattr(self, y).__get__(self, self.__class__) for y in [x for x in dir(self) if x.startswith(METHOD_PREFIX)]] if isinstance(z, collections_abc.Callable)]:
name = method.__name__[len(METHOD_PREFIX):]
name = name[0].lower() + name[1:]
self._methodsDict[name] = method
--
GitLab

View File

@ -2,13 +2,17 @@
Name: orca
Version: 41.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Assistive technology for people with visual impairments
License: LGPLv2+
URL: https://wiki.gnome.org/Projects/Orca
Source0: https://download.gnome.org/sources/%{name}/41/%{name}-%{tarball_version}.tar.xz
# Backported from upstream
# https://gitlab.gnome.org/GNOME/orca/-/merge_requests/121
Patch0: 121.patch
BuildArch: noarch
BuildRequires: pkgconfig(atk-bridge-2.0)
@ -76,6 +80,9 @@ desktop-file-validate %{buildroot}%{_sysconfdir}/xdg/autostart/orca-autostart.de
%changelog
* Tue Nov 16 2021 Kalev Lember <klember@redhat.com> - 41.0-2
- Backport another fix for compatibility with Python 3.10 (#2023682)
* Thu Sep 16 2021 Kalev Lember <klember@redhat.com> - 41.0-1
- Update to 41.0