calibre: update to 9.8.0

This commit is contained in:
Patrick Poitras
2026-05-10 21:33:00 +07:00
committed by Đoàn Trần Công Danh
parent cfd702b8c8
commit 157e8a0664
4 changed files with 127 additions and 123 deletions
@@ -0,0 +1,118 @@
From ef8fbea5ff37a4145bdbed91fdc8a6bdfdfc81ea Mon Sep 17 00:00:00 2001
From: Patrick Poitras <patrick@pfpoitras.com>
Date: Wed, 6 May 2026 19:14:43 -0700
Subject: [PATCH] Disable piper
---
setup/build.py | 8 ++++++++
setup/commands.py | 5 -----
setup/resources.py | 2 +-
src/calibre/gui2/tts/types.py | 5 +++--
src/calibre/test_build.py | 3 ++-
src/calibre/utils/run_tests.py | 5 +++--
6 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/setup/build.py b/setup/build.py
index 956ad7504f..54a5f1236a 100644
--- a/setup/build.py
+++ b/setup/build.py
@@ -444,6 +444,14 @@ def run(self, opts):
continue
if not is_ext_allowed(self.compiling_for, ext):
continue
+################################################################################
+# Void linux patch. The piper extension relies on `onnx` which isn't
+# packaged for void. It would also require espeak-ng > 1.52 also unpackaged
+# (last release is Dec 2024 and is missing the
+# espeak_TextToPhonemesWithTerminator() function.)
+################################################################################
+ if ext.name == "piper":
+ continue
if ext.error:
if ext.optional:
self.warn(ext.error)
diff --git a/setup/commands.py b/setup/commands.py
index faba5b437a..96e5682ce6 100644
--- a/setup/commands.py
+++ b/setup/commands.py
@@ -31,7 +31,6 @@
'manual',
'mathjax',
'osx',
- 'piper_voices',
'pot',
'publish',
'publish_betas',
@@ -95,10 +94,6 @@
hyphenation = Hyphenation()
-from setup.piper import PiperVoices
-
-piper_voices = PiperVoices()
-
from setup.liberation import LiberationFonts
liberation_fonts = LiberationFonts()
diff --git a/setup/resources.py b/setup/resources.py
index fbd918c5df..64a60bd0bf 100644
--- a/setup/resources.py
+++ b/setup/resources.py
@@ -104,7 +104,7 @@ def run(self, opts):
class Resources(Command): # {{{
description = 'Compile various needed calibre resources'
- sub_commands = ['liberation_fonts', 'mathjax', 'rapydscript', 'hyphenation', 'piper_voices']
+ sub_commands = ['liberation_fonts', 'mathjax', 'rapydscript', 'hyphenation']
def run(self, opts):
from calibre.utils.serialize import msgpack_dumps
diff --git a/src/calibre/gui2/tts/types.py b/src/calibre/gui2/tts/types.py
index a9ef058ae4..0db9b3dcc3 100644
--- a/src/calibre/gui2/tts/types.py
+++ b/src/calibre/gui2/tts/types.py
@@ -236,8 +236,9 @@ def qt_engine_metadata(name: str, human_name: str, desc: str, allows_choosing_au
continue
try:
- import calibre_extensions.piper as check_that_piper_imports
- del check_that_piper_imports
+ # import calibre_extensions.piper as check_that_piper_imports
+ # del check_that_piper_imports
+ pass
except ImportError:
pass
else:
diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py
index b60e2f1cd6..bfbed35e56 100644
--- a/src/calibre/test_build.py
+++ b/src/calibre/test_build.py
@@ -158,7 +158,8 @@ def test_plugins(self):
# Just check that the DLL can be loaded
ctypes.CDLL(os.path.join(plugins_loc, name + ('.dylib' if ismacos else '.so')))
continue
- import_module('calibre_extensions.' + name)
+ if 'piper' not in name:
+ import_module('calibre_extensions.' + name)
def test_lxml(self):
from calibre.utils.cleantext import test_clean_xml_chars
diff --git a/src/calibre/utils/run_tests.py b/src/calibre/utils/run_tests.py
index 19853589ff..7e880dff58 100644
--- a/src/calibre/utils/run_tests.py
+++ b/src/calibre/utils/run_tests.py
@@ -190,8 +190,9 @@ def test_import_of_all_python_modules(self):
'calibre.utils.linux_trash', 'calibre.utils.open_with.linux',
'calibre.gui2.linux_file_dialogs',
}
- if 'SKIP_SPEECH_TESTS' in os.environ:
- exclude_packages.add('calibre.gui2.tts')
+ exclude_packages.add('calibre.gui2.tts')
+ exclude_packages.add('calibre.utils.tts')
+ exclude_modules.add('calibre.gui2.tts.piper')
if not isbsd:
exclude_modules.add('calibre.devices.usbms.hal')
d = os.path.dirname
--
2.54.0
@@ -1,106 +0,0 @@
diff -Nur a/src/calibre/utils/_py313_scanner.py b/src/calibre/utils/_py313_scanner.py
--- a/src/calibre/utils/_py313_scanner.py 1969-12-31 19:00:00.000000000 -0500
+++ b/src/calibre/utils/_py313_scanner.py 2025-12-04 16:43:12.371808182 -0500
@@ -0,0 +1,52 @@
+### THIS FILE WAS ADDED SPECIFICALLY TO THE VOID LINUX PACKAGE
+###
+### Python 3.14.1 has restricted the use of re.Scanner to patterns that do not
+### use capturing groups because capturing groups never worked properly and can
+### cause the interpreter to crash. Cf.
+###
+### https://github.com/python/cpython/pull/140944
+###
+### The Scanner implementation is undocumented and there is some debate how to
+### address programs that rely on this now-missing functionality. Because it
+### seemed to work in calibre, and upstream has not addressed the change, we
+### will just vendor the implementation from Python 3.13 for now.
+
+from re import _compiler, _parser, RegexFlag
+class Scanner:
+ def __init__(self, lexicon, flags=0):
+ from re._constants import BRANCH, SUBPATTERN
+ if isinstance(flags, RegexFlag):
+ flags = flags.value
+ self.lexicon = lexicon
+ # combine phrases into a compound pattern
+ p = []
+ s = _parser.State()
+ s.flags = flags
+ for phrase, action in lexicon:
+ gid = s.opengroup()
+ p.append(_parser.SubPattern(s, [
+ (SUBPATTERN, (gid, 0, 0, _parser.parse(phrase, flags))),
+ ]))
+ s.closegroup(gid, p[-1])
+ p = _parser.SubPattern(s, [(BRANCH, (None, p))])
+ self.scanner = _compiler.compile(p)
+ def scan(self, string):
+ result = []
+ append = result.append
+ match = self.scanner.scanner(string).match
+ i = 0
+ while True:
+ m = match()
+ if not m:
+ break
+ j = m.end()
+ if i == j:
+ break
+ action = self.lexicon[m.lastindex-1][1]
+ if callable(action):
+ self.match = m
+ action = action(self, m.group())
+ if action is not None:
+ append(action)
+ i = j
+ return result, string[i:]
diff -Nur a/src/calibre/utils/formatter.py b/src/calibre/utils/formatter.py
--- a/src/calibre/utils/formatter.py 2025-07-17 23:41:17.000000000 -0400
+++ b/src/calibre/utils/formatter.py 2025-12-04 16:43:51.782906462 -0500
@@ -25,6 +25,7 @@
from calibre.utils.localization import _
from polyglot.builtins import error_message
+from ._py313_scanner import Scanner
class Node:
NODE_RVALUE = 1
@@ -1690,7 +1691,7 @@
compress_spaces = re.compile(r'\s+')
backslash_comma_to_comma = re.compile(r'\\,')
- arg_parser = re.Scanner([
+ arg_parser = Scanner([
(r',', lambda x,t: ''),
(r'.*?((?<!\\),)', lambda x,t: t[:-1]),
(r'.*?\)', lambda x,t: t[:-1]),
@@ -1698,7 +1699,7 @@
# ################# Template language lexical analyzer ######################
- lex_scanner = re.Scanner([
+ lex_scanner = Scanner([
(r'(==#|!=#|<=#|<#|>=#|>#)', lambda x,t: (_Parser.LEX_NUMERIC_INFIX, t)),
(r'(==|!=|<=|<|>=|>)', lambda x,t: (_Parser.LEX_STRING_INFIX, t)),
(r'(if|then|else|elif|fi)\b',lambda x,t: (_Parser.LEX_KEYWORD, t)),
diff -Nur a/src/calibre/utils/search_query_parser.py b/src/calibre/utils/search_query_parser.py
--- a/src/calibre/utils/search_query_parser.py 2025-07-17 23:41:17.000000000 -0400
+++ b/src/calibre/utils/search_query_parser.py 2025-12-04 16:44:16.500968101 -0500
@@ -28,6 +28,8 @@
from polyglot.binary import as_hex_unicode, from_hex_unicode
from polyglot.builtins import codepoint_to_chr
+from ._py313_scanner import Scanner
+
'''
This class manages access to the preference holding the saved search queries.
It exists to ensure that unicode is used throughout, and also to permit
@@ -157,7 +159,7 @@
docstring_sep = '□ༀ؆' # Unicode white square, Tibetian Om, Arabic-Indic Cube Root
# Had to translate named constants to numeric values
- lex_scanner = re.Scanner([
+ lex_scanner = Scanner([
(r'[()]', lambda x,t: (Parser.OPCODE, t)),
(r'@.+?:[^")\s]+', lambda x,t: (Parser.WORD, str(t))),
(r'[^"()\s]+', lambda x,t: (Parser.WORD, str(t))),
-11
View File
@@ -1,11 +0,0 @@
--- a/src/calibre/headless/CMakeLists.txt
+++ b/src/calibre/headless/CMakeLists.txt
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.21)
project(headless)
set(CMAKE_AUTOMOC ON)
-find_package(Qt6Gui REQUIRED)
+find_package(Qt6 REQUIRED COMPONENTS Gui GuiPrivate Core CorePrivate)
add_library(headless MODULE main.cpp headless_backingstore.cpp headless_integration.cpp)
set_property(TARGET headless PROPERTY QT_PLUGIN_TYPE "platforms")
set_property(TARGET headless PROPERTY QT_PLUGIN_CLASS_NAME "HeadlessIntegrationPlugin")
+9 -6
View File
@@ -1,7 +1,7 @@
# Template file for 'calibre'
pkgname=calibre
version=8.7.0
revision=4
version=9.8.0
revision=1
build_helper=python3
pycompile_dirs="/usr/lib/calibre/"
hostmakedepends="pkg-config cmake python3-BeautifulSoup4 python3-Pillow
@@ -17,7 +17,7 @@ makedepends="libinput-devel libmagick-devel libmtp-devel libstemmer-devel
python3-pyqt6-gui python3-pyqt6-svg python3-pyqt6-widgets python3-pyqt6-network
python3-pyqt6-printsupport python3-pyqt6-webengine python3-pyqt6-webchannel
qt6-base-private-devel python3-pyqt6-bindings python3-pyqt6-webengine-devel
ffmpeg6-devel"
ffmpeg6-devel python3-tzlocal"
depends="desktop-file-utils optipng poppler python3-BeautifulSoup4
qt6-imageformats python3-Pygments python3-pycryptodome python3-xxhash
python3-Markdown python3-Pillow python3-zeroconf python3-Pygments python3-apsw
@@ -31,7 +31,7 @@ depends="desktop-file-utils optipng poppler python3-BeautifulSoup4
python3-pyqt6-printsupport python3-pyqt6-webchannel python3-pyqt6-svg
python3-pyqt6-pdf python3-pyqt6-webengine python3-fonttools
python3-pyqt6-speech python3-pyqt6-multimedia python3-pykakasi
python3-lxml_html_clean"
python3-lxml_html_clean python3-tzlocal"
checkdepends="${depends} libjpeg-turbo-tools jxrlib"
short_desc="Ebook management application"
maintainer="Orphaned <orphan@voidlinux.org>"
@@ -39,7 +39,7 @@ license="GPL-3.0-only"
homepage="https://calibre-ebook.com"
changelog="https://raw.githubusercontent.com/kovidgoyal/calibre/master/Changelog.txt"
distfiles="https://download.calibre-ebook.com/${version}/calibre-${version}.tar.xz"
checksum=2cfe587e3773d8607fe8bbefbcd77b5cfb816124cac89e491353deb8f2fa9324
checksum=ddd916a246fc821e093dbac1b09f5d1b2fc84b53df36b014efbe6ac68f0268ef
python_version=3
lib32disabled=yes
nocross="python3 setup.py gui"
@@ -186,6 +186,8 @@ do_check() {
# test_recipe_browser_webengine case fails on ci
# test_piper not packaged
# test_websocket_basic fails
# test_tzdata fails because we don't specifically
# use pip-packaged version of tzdata
python3 setup.py test \
--exclude-test-name unrar \
--exclude-test-name qt \
@@ -193,7 +195,8 @@ do_check() {
--exclude-test-name test_dom_load \
--exclude-test-name test_recipe_browser_webengine \
--exclude-test-name test_piper \
--exclude-test-name test_websocket_basic
--exclude-test-name test_websocket_basic \
--exclude-test-name test_tzdata
}
do_install() {