[packages/calibre] - updated patches and BRs

baggins baggins at pld-linux.org
Tue Jun 28 00:10:33 CEST 2022


commit 49a96cf064645cce572b374ff07862c833207ccb
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Tue Jun 28 00:10:18 2022 +0200

    - updated patches and BRs

 calibre-locales.patch     |   4 +-
 calibre.spec              |  19 ++++----
 desktop-integration.patch |  48 +++++++++----------
 icu68.patch               | 119 ----------------------------------------------
 shebang-python-fix.patch  |   9 ----
 5 files changed, 35 insertions(+), 164 deletions(-)
---
diff --git a/calibre.spec b/calibre.spec
index df34e80..289b252 100644
--- a/calibre.spec
+++ b/calibre.spec
@@ -24,7 +24,6 @@ Patch1:		%{name}-locales.patch
 Patch2:		shebang-python-fix.patch
 Patch3:		desktop-integration.patch
 Patch4:		%{name}-env_module.patch
-Patch5:		icu68.patch
 %define		baeutifulsoup_ver 3.0.5
 %define		pil_ver 1.1.6
 %define		pyqt5_ver 5.3.1
@@ -61,10 +60,11 @@ BuildRequires:	pkgconfig
 BuildRequires:	podofo-devel >= 0.8.2
 BuildRequires:	poppler-glib-devel >= 0.28.1
 BuildRequires:	poppler-qt5-devel >= 0.28.1
-BuildRequires:	python3-BeautifulSoup >= %{baeutifulsoup_ver}
+#BuildRequires:	python3-BeautifulSoup >= %{baeutifulsoup_ver}
 BuildRequires:	python3-PIL >= %{pil_ver}
+BuildRequires:	python3-PyQt-builder
 BuildRequires:	python3-PyQt5 >= %{pyqt5_ver}
-BuildRequires:	python3-PyQt5-devel-tools >= %{pyqt5_ver}
+BuildRequires:	python-PyQt5-devel-tools >= %{pyqt5_ver}
 BuildRequires:	python3-PyQt5-uic >= %{pyqt5_ver}
 BuildRequires:	python3-PyQtWebEngine >= %{pyqt5_ver}
 BuildRequires:	python3-apsw >= %{apsw_ver}
@@ -75,11 +75,11 @@ BuildRequires:	python3-cssutils >= %{cssutils_ver}
 BuildRequires:	python3-dateutil >= %{dateutil_ver}
 BuildRequires:	python3-devel >= 1:2.7.1
 BuildRequires:	python3-dns >= %{dns_ver}
-BuildRequires:	python3-genshi
+#BuildRequires:	python3-genshi
 BuildRequires:	python3-html5-parser
 BuildRequires:	python3-lxml >= %{lxml_ver}
-BuildRequires:	python3-mechanize >= %{mechanize_ver}
-BuildRequires:	python3-modules-sqlite
+#BuildRequires:	python3-mechanize >= %{mechanize_ver}
+#BuildRequires:	python3-modules-sqlite
 BuildRequires:	python3-msgpack >= %{msgpack_ver}
 BuildRequires:	python3-netifaces >= %{netifaces_ver}
 BuildRequires:	python3-psutil >= %{psutil_ver}
@@ -187,7 +187,6 @@ Pakiet ten dostarcza uzupełnianie nazw dla calibre w powłoce zsh.
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
-%patch5 -p1
 
 # 64bit target build fix
 %{__sed} -i -e "s!'/usr/lib'!'%{_libdir}'!g" setup/build_environment.py
@@ -204,7 +203,7 @@ CXX=%{__cxx} \
 OVERRIDE_CFLAGS="%{rpmcflags}" \
 OVERRIDE_LDFLAGS="%{rpmldflags}" \
 QMAKE="%{_bindir}/qmake-qt5" \
-%{__python} setup.py build
+%{__python3} setup.py build
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -215,7 +214,7 @@ $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir},%{zsh_compdir}}
 export XDG_DATA_DIRS="$RPM_BUILD_ROOT%{_datadir}"
 export XDG_UTILS_INSTALL_MODE="system"
 export LIBPATH="%{_libdir}"
-%{__python} setup.py install \
+%{__python3} setup.py install \
 	--no-compile \
 	--root=$RPM_BUILD_ROOT \
 	--prefix=%{_prefix} \
@@ -223,7 +222,7 @@ export LIBPATH="%{_libdir}"
 	--libdir=%{_libdir} \
 	--sharedir=%{_datadir}
 
-%{__sed} -i -e '1s,/usr/bin/env python,%{__python},' $RPM_BUILD_ROOT%{_bindir}/*
+%{__sed} -i -e '1s,/usr/bin/env python,%{__python3},' $RPM_BUILD_ROOT%{_bindir}/*
 
 cp -p resources/images/library.png $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}-gui.png
 cp -p resources/images/viewer.png $RPM_BUILD_ROOT%{_pixmapsdir}/calibre-viewer.png
diff --git a/calibre-locales.patch b/calibre-locales.patch
index 5db0419..9c4f74c 100644
--- a/calibre-locales.patch
+++ b/calibre-locales.patch
@@ -53,7 +53,7 @@ diff -urNp -x '*.orig' calibre-4.20.0.org/src/calibre/translations/dynamic.py ca
 +               _CACHE[lang] = trans
      if trans is None:
          return getattr(__builtins__, '_', lambda x: x)(text)
-     f = getattr(trans, 'gettext' if ispy3 else 'ugettext')
+     return trans.gettext(text)
 diff -urNp -x '*.orig' calibre-4.20.0.org/src/calibre/utils/localization.py calibre-4.20.0/src/calibre/utils/localization.py
 --- calibre-4.20.0.org/src/calibre/utils/localization.py	2020-07-03 04:11:13.000000000 +0200
 +++ calibre-4.20.0/src/calibre/utils/localization.py	2021-06-23 14:08:43.642418411 +0200
@@ -113,7 +113,7 @@ diff -urNp -x '*.orig' calibre-4.20.0.org/src/calibre/utils/localization.py cali
  def get_single_translator(mpath, which='messages'):
 -    from zipfile import ZipFile
 -    with ZipFile(P('localization/locales.zip', allow_user_override=False), 'r') as zf:
--        path = '{}/{}.mo'.format(mpath, which)
+-        path = f'{mpath}/{which}.mo'
 -        data = zf.read(path)
 -        buf = io.BytesIO(data)
          try:
diff --git a/desktop-integration.patch b/desktop-integration.patch
index 458fe5e..a480379 100644
--- a/desktop-integration.patch
+++ b/desktop-integration.patch
@@ -2,30 +2,30 @@ diff -urNp -x '*.orig' calibre-4.20.0.org/src/calibre/linux.py calibre-4.20.0/sr
 --- calibre-4.20.0.org/src/calibre/linux.py	2021-06-23 14:08:51.192699952 +0200
 +++ calibre-4.20.0/src/calibre/linux.py	2021-06-23 14:08:53.186104962 +0200
 @@ -875,7 +875,7 @@ class PostInstall:
-                 def install_single_icon(iconsrc, basename, size, context, is_last_icon=False):
-                     filename = '%s-%s.png' % (basename, size)
-                     render_img(iconsrc, filename, width=int(size), height=int(size))
--                    cmd = ['xdg-icon-resource', 'install', '--noupdate', '--context', context, '--size', unicode_type(size), filename, basename]
-+                    cmd = ['xdg-icon-resource', 'install', '--noupdate', '--novendor', '--context', context, '--size', unicode_type(size), filename, basename]
-                     if is_last_icon:
-                         del cmd[2]
-                     cc(cmd)
+         def install_single_icon(iconsrc, basename, size, context, is_last_icon=False):
+             filename = f'{basename}-{size}.png'
+             render_img(iconsrc, filename, width=int(size), height=int(size))
+-            cmd = ['xdg-icon-resource', 'install', '--noupdate', '--context', context, '--size', str(size), filename, basename]
++            cmd = ['xdg-icon-resource', 'install', '--noupdate', '--novendor', '--context', context, '--size', str(size), filename, basename]
+             if is_last_icon:
+                 del cmd[2]
+             cc(cmd)
 @@ -941,7 +941,7 @@ class PostInstall:
  
-                 APPDATA = get_appdata()
-                 for x in des:
--                    cmd = ['xdg-desktop-menu', 'install', '--noupdate', './'+x]
-+                    cmd = ['xdg-desktop-menu', 'install', '--noupdate', '--novendor', './'+x]
-                     cc(' '.join(cmd), shell=True)
-                     self.menu_resources.append(x)
-                     ak = x.partition('.')[0]
+         APPDATA = get_appdata()
+         for x in des:
+-            cmd = ['xdg-desktop-menu', 'install', '--noupdate', './'+x]
++            cmd = ['xdg-desktop-menu', 'install', '--noupdate', '--novendor', './'+x]
+             cc(' '.join(cmd), shell=True)
+             self.menu_resources.append(x)
+             ak = x.partition('.')[0]
 @@ -951,8 +951,7 @@ class PostInstall:
-                 MIME = P(MIME_BASE)
-                 self.mime_resources.append(MIME_BASE)
-                 if not getattr(self.opts, 'staged_install', False):
--                    cc(['xdg-mime', 'install', MIME])
--                    cc(['xdg-desktop-menu', 'forceupdate'])
-+                    cc(['xdg-mime', 'install', '--novendor', MIME])
-                 else:
-                     from shutil import copyfile
-                     copyfile(MIME, os.path.join(env['XDG_DATA_DIRS'], 'mime', 'packages', MIME_BASE))
+         MIME = P(MIME_BASE)
+         self.mime_resources.append(MIME_BASE)
+         if not getattr(self.opts, 'staged_install', False):
+-            cc(['xdg-mime', 'install', MIME])
+-            cc(['xdg-desktop-menu', 'forceupdate'])
++            cc(['xdg-mime', 'install', '--novendor', MIME])
+         else:
+             from shutil import copyfile
+             copyfile(MIME, os.path.join(env['XDG_DATA_DIRS'], 'mime', 'packages', MIME_BASE))
diff --git a/icu68.patch b/icu68.patch
deleted file mode 100644
index 61cee29..0000000
--- a/icu68.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-From ca0aa5f6960c09e5cf5cb20249f895628fd97449 Mon Sep 17 00:00:00 2001
-From: Heiko Becker <heirecka at exherbo.org>
-Date: Sat, 5 Dec 2020 11:30:42 +0100
-Subject: [PATCH] Fix build with ICU >= 68
-
-ICU stopped defining the macros FALSE and TRUE in its headers with 68:
-https://github.com/unicode-org/icu/commit/c3fe7e09d844
----
- src/calibre/utils/icu.c     |  6 ++++--
- src/calibre/utils/matcher.c | 18 ++++++++----------
- 2 files changed, 12 insertions(+), 12 deletions(-)
-
-diff --git a/src/calibre/utils/icu.c b/src/calibre/utils/icu.c
-index 62d05de3101..36902dbdd25 100644
---- a/src/calibre/utils/icu.c
-+++ b/src/calibre/utils/icu.c
-@@ -1,5 +1,7 @@
- #include "icu_calibre_utils.h"
- 
-+#include <stdbool.h>
-+
- #define UPPER_CASE 0
- #define LOWER_CASE 1
- #define TITLE_CASE 2
-@@ -238,14 +240,14 @@ icu_Collator_contains(icu_Collator *self, PyObject *args) {
- 
-     a = python_to_icu(a_, &asz);
-     if (a == NULL) goto end;
--    if (asz == 0) { found = TRUE; goto end; }
-+    if (asz == 0) { found = true; goto end; }
-     b = python_to_icu(b_, &bsz);
-     if (b == NULL) goto end;
- 
-     search = usearch_openFromCollator(a, asz, b, bsz, self->collator, NULL, &status);
-     if (U_SUCCESS(status)) {
-         pos = usearch_first(search, &status);
--        if (pos != USEARCH_DONE) found = TRUE;
-+        if (pos != USEARCH_DONE) found = true;
-     }
- end:
-     if (search != NULL) usearch_close(search);
-diff --git a/src/calibre/utils/matcher.c b/src/calibre/utils/matcher.c
-index f38a7082cee..72715cc0ae3 100644
---- a/src/calibre/utils/matcher.c
-+++ b/src/calibre/utils/matcher.c
-@@ -9,15 +9,13 @@
- #define NO_PYTHON_TO_ICU32
- #include "icu_calibre_utils.h"
- #include <float.h>
-+#include <stdbool.h>
- 
- #ifdef _MSC_VER
- // inline does not work with the visual studio C compiler
- #define inline
- #endif
- 
--typedef unsigned char bool;
--#define TRUE 1
--#define FALSE 0
- #define MAX(x, y) ((x > y) ? x : y)
- #define nullfree(x) if(x != NULL) free(x); x = NULL;
- 
-@@ -240,10 +238,10 @@ static bool create_searches(UStringSearch **searches, UChar *haystack, int32_t h
-         U16_FWD_1(needle, i, needle_len);
-         if (pos == i) break;
-         searches[pos] = usearch_openFromCollator(needle + pos, i - pos, haystack, haystack_len, collator, NULL, &status);
--        if (U_FAILURE(status)) { PyErr_SetString(PyExc_ValueError, u_errorName(status)); searches[pos] = NULL; return FALSE; }
-+        if (U_FAILURE(status)) { PyErr_SetString(PyExc_ValueError, u_errorName(status)); searches[pos] = NULL; return false; }
-     }
- 
--    return TRUE;
-+    return true;
- }
- 
- static void free_searches(UStringSearch **searches, int32_t count) {
-@@ -259,14 +257,14 @@ static bool match(UChar **items, int32_t *item_lengths, uint32_t item_count, UCh
-     int32_t i = 0, maxhl = 0;
-     int32_t r = 0, *positions = NULL;
-     MatchInfo *matches = NULL;
--    bool ok = FALSE;
-+    bool ok = false;
-     MemoryItem ***memo = NULL;
-     int32_t needle_len = u_strlen(needle);
-     UStringSearch **searches = NULL;
- 
-     if (needle_len <= 0 || item_count <= 0) {
-         for (i = 0; i < (int32_t)item_count; i++) match_results[i].score = 0.0;
--        ok = TRUE;
-+        ok = true;
-         goto end;
-     }
- 
-@@ -289,7 +287,7 @@ static bool match(UChar **items, int32_t *item_lengths, uint32_t item_count, UCh
- 
-     if (maxhl <= 0) {
-         for (i = 0; i < (int32_t)item_count; i++) match_results[i].score = 0.0;
--        ok = TRUE;
-+        ok = true;
-         goto end;
-     }
- 
-@@ -308,7 +306,7 @@ static bool match(UChar **items, int32_t *item_lengths, uint32_t item_count, UCh
-         convert_positions(positions, final_positions + i * needle_char_len, matches[i].haystack, needle_char_len, needle_len, match_results[i].score);
-     }
- 
--    ok = TRUE;
-+    ok = true;
- end:
-     nullfree(positions);
-     nullfree(stack.items);
-@@ -401,7 +399,7 @@ static PyObject *
- Matcher_calculate_scores(Matcher *self, PyObject *args) {
-     int32_t *final_positions = NULL, *p;
-     Match *matches = NULL;
--    bool ok = FALSE;
-+    bool ok = false;
-     uint32_t i = 0, needle_char_len = 0, j = 0;
-     PyObject *items = NULL, *score = NULL, *positions = NULL, *pneedle = NULL;
-     UChar *needle = NULL;
diff --git a/shebang-python-fix.patch b/shebang-python-fix.patch
index 31baa20..a66a504 100644
--- a/shebang-python-fix.patch
+++ b/shebang-python-fix.patch
@@ -1,12 +1,3 @@
-diff -urNp -x '*.orig' calibre-4.20.0.org/recipes/nrc-nl-epub.recipe calibre-4.20.0/recipes/nrc-nl-epub.recipe
---- calibre-4.20.0.org/recipes/nrc-nl-epub.recipe	2020-07-03 04:11:13.000000000 +0200
-+++ calibre-4.20.0/recipes/nrc-nl-epub.recipe	2021-06-23 14:08:48.429265433 +0200
-@@ -1,4 +1,4 @@
--#!/usr/bin/env  python2
-+#!/usr/bin/env  python
- # -*- coding: utf-8 -*-
- # Based on veezh's original recipe and Kovid Goyal's New York Times recipe
- 
 diff -urNp -x '*.orig' calibre-4.20.0.org/setup/install.py calibre-4.20.0/setup/install.py
 --- calibre-4.20.0.org/setup/install.py	2021-06-23 14:08:46.395856286 +0200
 +++ calibre-4.20.0/setup/install.py	2021-06-23 14:08:48.429265433 +0200
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/calibre.git/commitdiff/49a96cf064645cce572b374ff07862c833207ccb



More information about the pld-cvs-commit mailing list