From bc77077d0bdc91642aed0313009b25ba2643a606 Mon Sep 17 00:00:00 2001 From: Scott Talbert Date: Jun 23 2021 13:01:35 +0000 Subject: Update to new upstream release 5.21.0 and fix build with sip5 --- diff --git a/.gitignore b/.gitignore index 98dc492..c856495 100644 --- a/.gitignore +++ b/.gitignore @@ -310,3 +310,5 @@ calibre-0.7.14-nofonts.tar.xz /calibre-4.19.0.tar.xz /calibre-4.22.0.tar.xz /calibre-4.23.0.tar.xz +/calibre-5.9.0.tar.xz +/calibre-5.21.0.tar.xz diff --git a/calibre-nodisplay.patch b/calibre-nodisplay.patch index f04dd7c..fb551bf 100644 --- a/calibre-nodisplay.patch +++ b/calibre-nodisplay.patch @@ -7,14 +7,14 @@ diff -up calibre/src/calibre/linux.py.orig calibre/src/calibre/linux.py Icon=calibre-viewer +NoDisplay=true MimeType=application/x-sony-bbeb; - Categories=Graphics;Viewer; + Categories=Office;Viewer; ''' @@ -948,6 +949,7 @@ Comment=Viewer for E-books in all the ma TryExec=ebook-viewer Exec=ebook-viewer --detach %f Icon=calibre-viewer +NoDisplay=true - Categories=Graphics;Viewer; + Categories=Office;Viewer; ''' @@ -961,6 +963,7 @@ Comment=Edit e-books in various formats @@ -22,6 +22,6 @@ diff -up calibre/src/calibre/linux.py.orig calibre/src/calibre/linux.py Exec=ebook-edit --detach %f Icon=calibre-ebook-edit +NoDisplay=true - Categories=Office; + Categories=Office;WordProcessor ''' diff --git a/calibre.spec b/calibre.spec index c6e0b88..468728c 100644 --- a/calibre.spec +++ b/calibre.spec @@ -1,12 +1,10 @@ -%{?_sip_api:Requires: python3-pyqt5-sip-api(%{_sip_api_major}) >= %{_sip_api}} - %global __provides_exclude_from ^%{_libdir}/calibre/calibre/plugins/.*\.so$ %global _python_bytecompile_extra 0 Name: calibre -Version: 4.23.0 -Release: 7%{?dist} +Version: 5.21.0 +Release: 1%{?dist} Summary: E-book converter and library manager License: GPLv3 URL: https://calibre-ebook.com/ @@ -24,6 +22,10 @@ Patch3: calibre-nodisplay.patch # sgml was removed, so disable test for it. Patch5: https://github.com/keszybz/calibre/commit/01bf854923741bf8d6a6328f17d61e0ec5ac3c9f.patch +Patch6: python3.10-1.patch +Patch7: python3.10-2.patch +Patch8: python3.10-3.patch + ExclusiveArch: %{qt5_qtwebengine_arches} BuildRequires: python3-devel @@ -70,10 +72,17 @@ BuildRequires: python3dist(html5-parser) >= 0.4.8 BuildRequires: python3dist(html2text) BuildRequires: python3dist(zeroconf) BuildRequires: python3dist(markdown) >= 3.0 +BuildRequires: python3dist(sip) >= 5.5 +BuildRequires: python3dist(pyqt-builder) +BuildRequires: python3dist(pychm) +BuildRequires: python3dist(pycrypto) +BuildRequires: python3dist(cchardet) +BuildRequires: python3-speechd BuildRequires: hunspell-devel BuildRequires: qt5-qtwebengine-devel BuildRequires: python-qt5-webengine BuildRequires: hyphen-devel +BuildRequires: qt5-qtimageformats # using the bundled mathjax until Fedora updates to 3.0.0 #BuildRequires: mathjax # Those are only used for tests. Do not add to runtime deps. @@ -95,6 +104,7 @@ Requires: python-qt5-webengine Requires: qt5-qtwebengine Requires: qt5-qtsvg Requires: qt5-qtsensors +Requires: qt5-qtimageformats Requires: poppler-utils Requires: liberation-sans-fonts Requires: liberation-serif-fonts @@ -121,6 +131,7 @@ Requires: python3dist(regex) Requires: python3dist(html5-parser) >= 0.4.8 Requires: python3dist(html2text) Requires: python3dist(markdown) >= 3.0 +Requires: python3dist(pyqt5-sip) >= 12.8, python3dist(pyqt5-sip) < 13 Requires: udisks2 Recommends: python3dist(zeroconf) @@ -289,16 +300,18 @@ rm -f %{buildroot}/%{_datadir}/metainfo/calibre-ebook-viewer.appdata.xml # skip failing tests: # - unrar (missing dependencies) # - bonjour (problems in mock) +# - 7z (missing dependencies) # - qt (fails on 32-bit architectures only) CALIBRE_PY3_PORT=1 \ %{__python3} setup.py test \ --exclude-test-name unrar \ --exclude-test-name bonjour \ + --exclude-test-name 7z \ %ifarch i686 armv7hl --exclude-test-name qt %endif -appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/calibre-gui.appdata.xml +appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/calibre-gui.metainfo.xml %preun if [ -L %{_datadir}/calibre/mathjax ]; then @@ -310,7 +323,7 @@ fi %files %license LICENSE -%doc Changelog.yaml COPYRIGHT README.md +%doc Changelog.txt COPYRIGHT README.md %{_bindir}/calibre %{_bindir}/calibre-complete %{_bindir}/calibre-customize @@ -342,9 +355,12 @@ fi %{python3_sitelib}/__pycache__/init_calibre.*.py* %{_datadir}/bash-completion/completions %{_datadir}/zsh/site-functions/_calibre -%{_datadir}/metainfo/*.appdata.xml +%{_datadir}/metainfo/*.metainfo.xml %changelog +* Thu Jun 10 2021 Scott Talbert - 5.21.0-1 +- Update to new upstream release 5.21.0 and fix build with sip5 + * Fri Jun 04 2021 Python Maint - 4.23.0-7 - Rebuilt for Python 3.10 diff --git a/python3.10-1.patch b/python3.10-1.patch new file mode 100644 index 0000000..be6825c --- /dev/null +++ b/python3.10-1.patch @@ -0,0 +1,138 @@ +From 2e272a39d0efee74c840873e9164dce50640a3d8 Mon Sep 17 00:00:00 2001 +From: Scott Talbert +Date: Wed, 16 Jun 2021 14:19:40 -0400 +Subject: [PATCH] Fix building with Python 3.10 + +--- + src/calibre/constants.py | 4 ++-- + src/calibre/db/cache.py | 3 ++- + src/calibre/db/lazy.py | 2 +- + src/calibre/test_build.py | 2 +- + src/calibre/utils/dbus_service.py | 2 +- + src/calibre/utils/run_tests.py | 5 ++--- + src/css_selectors/ordered_set.py | 4 ++-- + 7 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/src/calibre/constants.py b/src/calibre/constants.py +index 330ef1e0e1..b0b9002de2 100644 +--- a/src/calibre/constants.py ++++ b/src/calibre/constants.py +@@ -2,7 +2,7 @@ + # vim:fileencoding=utf-8 + # License: GPLv3 Copyright: 2015, Kovid Goyal + 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' + numeric_version = (5, 21, 0) +@@ -291,7 +291,7 @@ def find_spec(self, fullname, path=None, target=None): + from calibre_extensions import winutil + + +-class Plugins(collections.Mapping): ++class Plugins(collections.abc.Mapping): + + def __iter__(self): + from importlib.resources import contents +diff --git a/src/calibre/db/cache.py b/src/calibre/db/cache.py +index 958da81fa1..d0fa2403b9 100644 +--- a/src/calibre/db/cache.py ++++ b/src/calibre/db/cache.py +@@ -12,7 +12,8 @@ + import shutil + import sys + import traceback +-from collections import MutableSet, Set, defaultdict ++from collections import defaultdict ++from collections.abc import MutableSet, Set + from functools import partial, wraps + from io import BytesIO + from threading import Lock +diff --git a/src/calibre/db/lazy.py b/src/calibre/db/lazy.py +index d2b7398f24..d67ec8397c 100644 +--- a/src/calibre/db/lazy.py ++++ b/src/calibre/db/lazy.py +@@ -8,7 +8,7 @@ + + import weakref + from functools import wraps +-from collections import MutableMapping, MutableSequence ++from collections.abc import MutableMapping, MutableSequence + from copy import deepcopy + + from calibre.ebooks.metadata.book.base import Metadata, SIMPLE_GET, TOP_LEVEL_IDENTIFIERS, NULL_VALUES, ALL_METADATA_FIELDS +diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py +index 799bc02179..5c58ff5431 100644 +--- a/src/calibre/test_build.py ++++ b/src/calibre/test_build.py +@@ -48,7 +48,7 @@ def test_dbus(self): + + def test_loaders(self): + import importlib +- ldr = importlib.import_module('calibre').__spec__.loader ++ ldr = importlib.import_module('calibre').__spec__.loader.get_resource_reader() + self.assertIn('ebooks', ldr.contents()) + try: + raw = ldr.open_resource('__init__.py').read() +diff --git a/src/calibre/utils/dbus_service.py b/src/calibre/utils/dbus_service.py +index e04b6524b6..fb38136daf 100644 +--- a/src/calibre/utils/dbus_service.py ++++ b/src/calibre/utils/dbus_service.py +@@ -33,7 +33,7 @@ + import logging + import threading + import traceback +-from collections import Sequence ++from collections.abc import Sequence + + import _dbus_bindings + from dbus import ( +diff --git a/src/calibre/utils/run_tests.py b/src/calibre/utils/run_tests.py +index 673de4bcc4..2b5034b01b 100644 +--- a/src/calibre/utils/run_tests.py ++++ b/src/calibre/utils/run_tests.py +@@ -3,7 +3,7 @@ + # License: GPLv3 Copyright: 2016, Kovid Goyal + + +-import unittest, functools, importlib ++import unittest, functools, importlib, importlib.resources + from calibre.utils.monotonic import monotonic + + +@@ -54,8 +54,7 @@ def stopTestRun(self): + + + def find_tests_in_package(package, excludes=('main.py',)): +- loader = importlib.import_module(package).__spec__.loader +- items = list(loader.contents()) ++ items = list(importlib.resources.contents(package)) + suits = [] + excludes = set(excludes) | {x + 'c' for x in excludes} + seen = set() +diff --git a/src/css_selectors/ordered_set.py b/src/css_selectors/ordered_set.py +index 369d3e122d..51c30c2eb2 100644 +--- a/src/css_selectors/ordered_set.py ++++ b/src/css_selectors/ordered_set.py +@@ -5,7 +5,7 @@ + __license__ = 'GPL v3' + __copyright__ = '2015, Kovid Goyal ' + +-import collections ++import collections.abc + from polyglot.builtins import string_or_bytes + + SLICE_ALL = slice(None) +@@ -23,7 +23,7 @@ def is_iterable(obj): + 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 + every entry has an index that can be looked up. +-- +2.31.1 + diff --git a/python3.10-2.patch b/python3.10-2.patch new file mode 100644 index 0000000..e56bf82 --- /dev/null +++ b/python3.10-2.patch @@ -0,0 +1,27 @@ +From 82fecc9e0dcf0c077e01a16f156e5cf1908467d1 Mon Sep 17 00:00:00 2001 +From: Scott Talbert +Date: Tue, 22 Jun 2021 21:46:34 -0400 +Subject: [PATCH] Fix ThrobbingButton init with Python 3.10 + +It is no longer possible to pass floats to C functions where ints are +expected, so explicitly convert to int in this case. +--- + src/calibre/gui2/throbber.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/calibre/gui2/throbber.py b/src/calibre/gui2/throbber.py +index c0cc280267..b0ede83650 100644 +--- a/src/calibre/gui2/throbber.py ++++ b/src/calibre/gui2/throbber.py +@@ -33,7 +33,7 @@ def __init__(self, *args): + QToolButton.setIcon(self, QIcon(I('donate.png'))) + self.setText('\xa0') + self.animation = QPropertyAnimation(self, b'icon_size', self) +- self.animation.setDuration(60/72.*1000) ++ self.animation.setDuration(int(60/72.*1000)) + self.animation.setLoopCount(4) + self.animation.valueChanged.connect(self.value_changed) + self.setCursor(Qt.CursorShape.PointingHandCursor) +-- +2.31.1 + diff --git a/python3.10-3.patch b/python3.10-3.patch new file mode 100644 index 0000000..b38115e --- /dev/null +++ b/python3.10-3.patch @@ -0,0 +1,58 @@ +From d395a910e56bcb10a7b63b4600bba1926bcf78c2 Mon Sep 17 00:00:00 2001 +From: Eli Schwartz +Date: Tue, 22 Jun 2021 23:04:00 -0400 +Subject: [PATCH] python 3.10: explicitly cast some numbers to int + +These currently raise deprecation warnings, but will no longer get +autoconverted in python 3.10 + +- Some Qt functions expect int, not float, and got truncated automatically. +- The QSocketNotifier is sip.voidptr wrapping an int file descriptor +--- + src/calibre/gui2/__init__.py | 2 +- + src/calibre/gui2/library/alternate_views.py | 2 +- + src/calibre/gui2/store/search/results_view.py | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py +index d79817039c..0b77e7bed1 100644 +--- a/src/calibre/gui2/__init__.py ++++ b/src/calibre/gui2/__init__.py +@@ -1221,7 +1221,7 @@ def setup_unix_signals(self): + + def signal_received(self): + try: +- os.read(self.signal_notifier.socket(), 1024) ++ os.read(int(self.signal_notifier.socket()), 1024) + except OSError: + return + self.shutdown_signal_received.emit() +diff --git a/src/calibre/gui2/library/alternate_views.py b/src/calibre/gui2/library/alternate_views.py +index 756f50c73b..e78e333fa2 100644 +--- a/src/calibre/gui2/library/alternate_views.py ++++ b/src/calibre/gui2/library/alternate_views.py +@@ -430,7 +430,7 @@ def set_dimensions(self): + width = 0.75 * height + else: + width *= self.parent().logicalDpiX() * CM_TO_INCH +- self.cover_size = QSize(width, height) ++ self.cover_size = QSize(int(width), int(height)) + self.title_height = 0 + if show_title: + f = self.parent().font() +diff --git a/src/calibre/gui2/store/search/results_view.py b/src/calibre/gui2/store/search/results_view.py +index bc738ed2ee..162102833f 100644 +--- a/src/calibre/gui2/store/search/results_view.py ++++ b/src/calibre/gui2/store/search/results_view.py +@@ -31,7 +31,7 @@ def paint(self, painter, option, index): + dpr = img.devicePixelRatio() + scaled, nw, nh = fit_image(img.width(), img.height(), w, h) + if scaled: +- img = img.scaled(nw*dpr, nh*dpr, Qt.AspectRatioMode.IgnoreAspectRatio, Qt.TransformationMode.SmoothTransformation) ++ img = img.scaled(int(nw*dpr), int(nh*dpr), Qt.AspectRatioMode.IgnoreAspectRatio, Qt.TransformationMode.SmoothTransformation) + iw, ih = int(img.width()/dpr), int(img.height()/dpr) + dx, dy = (option.rect.width() - iw) // 2, (option.rect.height() - ih) // 2 + painter.drawPixmap(option.rect.adjusted(dx, dy, -dx, -dy), img) +-- +2.31.1 + diff --git a/sources b/sources index caeb7cb..c3d8fd0 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (calibre-4.23.0.tar.xz) = 2a512f29ddc2fed7f6a229314a9f7fceac198c9422b3be19078685032f1d1cb3b9258ac2609c33d15da20683c1277ed09419ea1e9bbc70430cdc676f60395719 +SHA512 (calibre-5.21.0.tar.xz) = 88aab7ec5a66ef0ce4071d8bb8bdcdacd44164403b795003152cb9c1a2973fdf8842eb83246e8c27710dcb2e94b1c343f2c2be940e12affd671923046023b92f