mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix building with Python 3.10
This commit is contained in:
parent
c9c1029d02
commit
2e272a39d0
@ -2,7 +2,7 @@
|
|||||||
# vim:fileencoding=utf-8
|
# vim:fileencoding=utf-8
|
||||||
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
|
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
from polyglot.builtins import map, unicode_type, environ_item, hasenv, getenv
|
from polyglot.builtins import map, unicode_type, environ_item, hasenv, getenv
|
||||||
import sys, locale, codecs, os, collections
|
import sys, locale, codecs, os, collections, collections.abc
|
||||||
|
|
||||||
__appname__ = 'calibre'
|
__appname__ = 'calibre'
|
||||||
numeric_version = (5, 21, 0)
|
numeric_version = (5, 21, 0)
|
||||||
@ -291,7 +291,7 @@ if iswindows:
|
|||||||
from calibre_extensions import winutil
|
from calibre_extensions import winutil
|
||||||
|
|
||||||
|
|
||||||
class Plugins(collections.Mapping):
|
class Plugins(collections.abc.Mapping):
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
from importlib.resources import contents
|
from importlib.resources import contents
|
||||||
|
@ -12,7 +12,8 @@ import random
|
|||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
from collections import MutableSet, Set, defaultdict
|
from collections import defaultdict
|
||||||
|
from collections.abc import MutableSet, Set
|
||||||
from functools import partial, wraps
|
from functools import partial, wraps
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
|
@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import weakref
|
import weakref
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from collections import MutableMapping, MutableSequence
|
from collections.abc import MutableMapping, MutableSequence
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from calibre.ebooks.metadata.book.base import Metadata, SIMPLE_GET, TOP_LEVEL_IDENTIFIERS, NULL_VALUES, ALL_METADATA_FIELDS
|
from calibre.ebooks.metadata.book.base import Metadata, SIMPLE_GET, TOP_LEVEL_IDENTIFIERS, NULL_VALUES, ALL_METADATA_FIELDS
|
||||||
|
@ -48,7 +48,7 @@ class BuildTest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_loaders(self):
|
def test_loaders(self):
|
||||||
import importlib
|
import importlib
|
||||||
ldr = importlib.import_module('calibre').__spec__.loader
|
ldr = importlib.import_module('calibre').__spec__.loader.get_resource_reader()
|
||||||
self.assertIn('ebooks', ldr.contents())
|
self.assertIn('ebooks', ldr.contents())
|
||||||
try:
|
try:
|
||||||
raw = ldr.open_resource('__init__.py').read()
|
raw = ldr.open_resource('__init__.py').read()
|
||||||
|
@ -33,7 +33,7 @@ import sys
|
|||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
import traceback
|
import traceback
|
||||||
from collections import Sequence
|
from collections.abc import Sequence
|
||||||
|
|
||||||
import _dbus_bindings
|
import _dbus_bindings
|
||||||
from dbus import (
|
from dbus import (
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
|
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
|
|
||||||
|
|
||||||
import unittest, functools, importlib
|
import unittest, functools, importlib, importlib.resources
|
||||||
from calibre.utils.monotonic import monotonic
|
from calibre.utils.monotonic import monotonic
|
||||||
|
|
||||||
|
|
||||||
@ -54,8 +54,7 @@ class TestResult(unittest.TextTestResult):
|
|||||||
|
|
||||||
|
|
||||||
def find_tests_in_package(package, excludes=('main.py',)):
|
def find_tests_in_package(package, excludes=('main.py',)):
|
||||||
loader = importlib.import_module(package).__spec__.loader
|
items = list(importlib.resources.contents(package))
|
||||||
items = list(loader.contents())
|
|
||||||
suits = []
|
suits = []
|
||||||
excludes = set(excludes) | {x + 'c' for x in excludes}
|
excludes = set(excludes) | {x + 'c' for x in excludes}
|
||||||
seen = set()
|
seen = set()
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
|
|
||||||
import collections
|
import collections.abc
|
||||||
from polyglot.builtins import string_or_bytes
|
from polyglot.builtins import string_or_bytes
|
||||||
|
|
||||||
SLICE_ALL = slice(None)
|
SLICE_ALL = slice(None)
|
||||||
@ -23,7 +23,7 @@ def is_iterable(obj):
|
|||||||
return hasattr(obj, '__iter__') and not isinstance(obj, string_or_bytes)
|
return hasattr(obj, '__iter__') and not isinstance(obj, string_or_bytes)
|
||||||
|
|
||||||
|
|
||||||
class OrderedSet(collections.MutableSet):
|
class OrderedSet(collections.abc.MutableSet):
|
||||||
"""
|
"""
|
||||||
An OrderedSet is a custom MutableSet that remembers its order, so that
|
An OrderedSet is a custom MutableSet that remembers its order, so that
|
||||||
every entry has an index that can be looked up.
|
every entry has an index that can be looked up.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user