void-packages/srcpkgs/quodlibet/patches/collections_abc.patch
2021-10-15 19:52:49 -04:00

103 lines
3.1 KiB
Diff

Upstream: yes
commit d4e05aef03fe9775de9c00f2730d89815450022e
Author: LuK1337 <priv.luk@gmail.com>
Date: Sat Sep 11 11:46:46 2021 +0200
Finish up collections -> collections.abc migration
This lets us start QuodLibet on Python 3.10 ^.^
diff --git a/quodlibet/packages/raven/context.py b/quodlibet/packages/raven/context.py
index 272259a3b..2a3eab4a7 100644
--- a/quodlibet/packages/raven/context.py
+++ b/quodlibet/packages/raven/context.py
@@ -7,7 +7,10 @@ raven.context
"""
from __future__ import absolute_import
-from collections import Mapping, Iterable
+try:
+ from collections import abc
+except ImportError:
+ import collections as abc # type: ignore
from threading import local
from weakref import ref as weakref
@@ -30,7 +33,7 @@ def get_active_contexts():
return []
-class Context(local, Mapping, Iterable):
+class Context(local, abc.Mapping, abc.Iterable):
"""
Stores context until cleared.
diff --git a/quodlibet/player/gstbe/util.py b/quodlibet/player/gstbe/util.py
index 2611f8120..7439b716a 100644
--- a/quodlibet/player/gstbe/util.py
+++ b/quodlibet/player/gstbe/util.py
@@ -6,7 +6,10 @@
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-import collections
+try:
+ from collections import abc
+except ImportError:
+ import collections as abc # type: ignore
import subprocess
from enum import Enum
from typing import Iterable, Tuple
@@ -183,7 +186,7 @@ def GStreamerSink(pipeline_desc):
return pipe, pipeline_desc
-class TagListWrapper(collections.Mapping):
+class TagListWrapper(abc.Mapping):
def __init__(self, taglist, merge=False):
self._list = taglist
self._merge = merge
diff --git a/quodlibet/util/collection.py b/quodlibet/util/collection.py
index b726f98e9..83646b8af 100644
--- a/quodlibet/util/collection.py
+++ b/quodlibet/util/collection.py
@@ -24,7 +24,10 @@ from quodlibet.formats._audio import (TAG_TO_SORT, NUMERIC_ZERO_DEFAULT,
AudioFile)
from quodlibet.formats._audio import PEOPLE as _PEOPLE
from quodlibet.pattern import Pattern
-from collections import Iterable
+try:
+ from collections import abc
+except ImportError:
+ import collections as abc # type: ignore
from quodlibet.util import is_windows
from quodlibet.util.path import escape_filename, unescape_filename, limit_path
@@ -332,7 +335,7 @@ class Album(Collection):
@hashable
@total_ordering
-class Playlist(Collection, Iterable):
+class Playlist(Collection, abc.Iterable):
"""A Playlist is a `Collection` that has list-like features
Songs can appear more than once.
"""
diff --git a/quodlibet/util/collections.py b/quodlibet/util/collections.py
index ba9d5c1a4..f0b83b5e9 100644
--- a/quodlibet/util/collections.py
+++ b/quodlibet/util/collections.py
@@ -9,7 +9,12 @@
from __future__ import absolute_import
-from collections import MutableSequence, defaultdict
+try:
+ from collections.abc import MutableSequence
+except ImportError:
+ from collections import MutableSequence
+from collections import defaultdict
+from typing import Any
from .misc import total_ordering