[packages/calibre] - up to 3.44
baggins
baggins at pld-linux.org
Sun Jun 9 19:37:38 CEST 2019
commit 7b172d7ef41f70ee87d0bd82d615db011e4ce7cb
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Sun Jun 9 19:36:36 2019 +0200
- up to 3.44
calibre-locales.patch | 34 +++++++++++++++++++++++++---------
calibre-prefix.patch | 24 ++++++++++++++++++++++++
calibre.spec | 41 ++++++++++++++++-------------------------
desktop-integration.patch | 26 ++++++++++++--------------
shebang-python-fix.patch | 2 +-
5 files changed, 78 insertions(+), 49 deletions(-)
---
diff --git a/calibre.spec b/calibre.spec
index 09907fd..06f12b5 100644
--- a/calibre.spec
+++ b/calibre.spec
@@ -11,12 +11,12 @@
Summary: E-book converter and library management
Summary(pl.UTF-8): Konwerter oraz biblioteka dla e-booków
Name: calibre
-Version: 3.31.0
-Release: 2
+Version: 3.44.0
+Release: 1
License: GPL v3+
Group: Applications/Multimedia
Source0: %{name}-%{version}-nofonts.tar.xz
-# Source0-md5: 8e412cf8615b06cd5a432e1212f33517
+# Source0-md5: 306d559dc5c4bc4c8191ce3004a6137e
Source1: generate-tarball.sh
Source2: %{name}-mount-helper
Patch0: %{name}-prefix.patch
@@ -62,7 +62,9 @@ BuildRequires: python-PyQt5 >= %{pyqt5_ver}
BuildRequires: python-PyQt5-devel-tools >= %{pyqt5_ver}
BuildRequires: python-PyQt5-uic >= %{pyqt5_ver}
BuildRequires: python-apsw >= %{apsw_ver}
+BuildRequires: python-bs4
BuildRequires: python-cssselect >= %{cssselect_ver}
+BuildRequires: python-css_parser
BuildRequires: python-cssutils >= %{cssutils_ver}
BuildRequires: python-dateutil >= %{dateutil_ver}
BuildRequires: python-devel >= 1:2.7.1
@@ -94,7 +96,9 @@ Requires: python-BeautifulSoup >= %{baeutifulsoup_ver}
Requires: python-PIL >= %{pil_ver}
Requires: python-PyQt5 >= %{pyqt5_ver}
Requires: python-apsw >= %{apsw_ver}
+Requires: python-bs4
Requires: python-cssselect >= %{cssselect_ver}
+Requires: python-css_parser
Requires: python-cssutils >= %{cssutils_ver}
Requires: python-dateutil >= %{dateutil_ver}
Requires: python-dns >= %{dns_ver}
@@ -201,14 +205,16 @@ rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT%{_datadir}/{icons/hicolor,packages,mime/packages,desktop-directories} \
$RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir},/usr/share/zsh/site-functions}
-XDG_DATA_DIRS="$RPM_BUILD_ROOT%{_datadir}" \
-XDG_UTILS_INSTALL_MODE="system" \
-LIBPATH="%{_libdir}" \
+export XDG_DATA_DIRS="$RPM_BUILD_ROOT%{_datadir}"
+export XDG_UTILS_INSTALL_MODE="system"
+export LIBPATH="%{_libdir}"
%{__python} setup.py install \
--no-compile \
- --prefix=%{_prefix} \
--root=$RPM_BUILD_ROOT \
- --libdir=%{_libdir}
+ --prefix=%{_prefix} \
+ --bindir=%{_bindir} \
+ --libdir=%{_libdir} \
+ --sharedir=%{_datadir}
%{__sed} -i -e '1s,/usr/bin/env python,%{__python},' $RPM_BUILD_ROOT%{_bindir}/*
@@ -238,13 +244,6 @@ for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/iso639.mo; do
%{__mv} $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/iso639.mo \
$RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}_iso639.mo
done;
-for file in $RPM_BUILD_ROOT%{_localedir}/*/lcdata.pickle; do
- lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/lcdata.pickle:\1:')
- %{__mv} $RPM_BUILD_ROOT%{_localedir}/$lang/lcdata.pickle \
- $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}_lcdata.pickle
-done;
-
-%{__rm} $RPM_BUILD_ROOT%{_bindir}/%{name}-uninstall
# duplicates of bn,sl
%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/{bn_BD,sl_SI}
@@ -254,8 +253,8 @@ done;
install %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}
%find_lang %{name} --all-name
-for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/%{name}_lcdata.pickle; do
- lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
+for file in $RPM_BUILD_ROOT%{_localedir}/*/lcdata.calibre_msgpack; do
+ lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/.*:\1:')
echo $file | %{__sed} "s:$RPM_BUILD_ROOT\(.*\):%lang($lang) \1:" >>%{name}.lang
done;
@@ -320,15 +319,7 @@ fi
%{_iconsdir}/hicolor/*x*/mimetypes/gnome-mime-application-x-topaz-ebook.png
%{_iconsdir}/hicolor/*x*/mimetypes/gnome-mime-text-lrs.png
%{_iconsdir}/hicolor/*x*/mimetypes/text-lrs.png
-%{_datadir}/mime/application/epub+zip.xml
-%{_datadir}/mime/application/x-kindle-application.xml
-%{_datadir}/mime/application/x-mobi8-ebook.xml
-%{_datadir}/mime/application/x-mobipocket-ebook.xml
-%{_datadir}/mime/application/x-mobipocket-subscription.xml
-%{_datadir}/mime/application/x-sony-bbeb.xml
-%{_datadir}/mime/application/x-topaz-ebook.xml
%{_datadir}/mime/packages/calibre-mimetypes.xml
-%{_datadir}/mime/text/lrs.xml
%{_pixmapsdir}/calibre-gui.png
%{_pixmapsdir}/calibre-viewer.png
diff --git a/calibre-locales.patch b/calibre-locales.patch
index a35a01e..761389c 100644
--- a/calibre-locales.patch
+++ b/calibre-locales.patch
@@ -40,7 +40,7 @@
__copyright__ = '2008, Marshall T. Vandegrift <llasram at gmail.com>'
+import os
- import cStringIO
+ import io
from gettext import GNUTranslations
from calibre.utils.localization import get_lc_messages_path
-from zipfile import ZipFile
@@ -54,7 +54,7 @@
- with ZipFile(P('localization/locales.zip',
- allow_user_override=False), 'r') as zf:
- try:
-- buf = cStringIO.StringIO(zf.read(mpath + '/messages.mo'))
+- buf = io.BytesIO(zf.read(mpath + '/messages.mo'))
- except:
- pass
- else:
@@ -112,7 +112,7 @@
- for lang in available_translations():
- mpath = get_lc_messages_path(lang)
- if mpath is not None:
-- buf = cStringIO.StringIO(zf.read(mpath + '/messages.mo'))
+- buf = io.BytesIO(zf.read(mpath + '/messages.mo'))
- yield lang, GNUTranslations(buf)
+ for lang in available_translations():
+ mpath = get_lc_messages_path(lang)
@@ -125,15 +125,30 @@
lcdata = {
u'abday': (u'Sun', u'Mon', u'Tue', u'Wed', u'Thu', u'Fri', u'Sat'),
-@@ -145,21 +145,20 @@
- buf = cStringIO.StringIO(buf.getvalue())
+@@ -134,10 +134,11 @@
+
+
+ def get_single_translator(mpath, which='messages'):
+- from zipfile import ZipFile
+- with ZipFile(P('localization/locales.zip', allow_user_override=False), 'r') as zf:
+- buf = io.BytesIO(zf.read(mpath + '/%s.mo' % which))
++ try:
++ buf = open(os.path.join(mpath, '/%s.mo' % which), 'rb')
+ return GNUTranslations(buf)
++ except:
++ pass # No translations for this lang
+
+
+ def get_iso639_translator(lang):
+@@ -145,22 +145,21 @@
+ buf = io.BytesIO(buf.getvalue())
if mpath is not None:
- from zipfile import ZipFile
- with ZipFile(P('localization/locales.zip',
- allow_user_override=False), 'r') as zf:
- if buf is None:
-- buf = cStringIO.StringIO(zf.read(mpath + '/messages.mo'))
+- buf = io.BytesIO(zf.read(mpath + '/messages.mo'))
+ if buf is None:
+ try:
+ buf = open(os.path.join(mpath, 'calibre.mo'), 'rb')
@@ -143,14 +158,15 @@
mpath = 'de'
- isof = mpath + '/iso639.mo'
try:
-- iso639 = cStringIO.StringIO(zf.read(isof))
+- iso639 = io.BytesIO(zf.read(isof))
+ iso639 = open(os.path.join(mpath, 'calibre_iso639.mo'), 'rb')
except:
pass # No iso639 translations for this lang
if buf is not None:
+ from calibre.utils.serialize import msgpack_loads
try:
-- lcdata = cPickle.loads(zf.read(mpath + '/lcdata.pickle'))
-+ lcdata = cPickle.loads(open(os.path.join(mpath, 'calibre_lcdata.pickle')))
+- lcdata = msgpack_loads(zf.read(mpath + '/lcdata.calibre_msgpack'))
++ lcdata = msgpack_loads(open(os.path.join(mpath, '/lcdata.calibre_msgpack')))
except:
pass # No lcdata
diff --git a/calibre-prefix.patch b/calibre-prefix.patch
index 31a94fc..cb4fa73 100644
--- a/calibre-prefix.patch
+++ b/calibre-prefix.patch
@@ -20,3 +20,27 @@
self.staging_libdir = opts.staging_libdir = self.j(self.staging_libdir, 'calibre')
self.staging_sharedir = opts.staging_sharedir = self.j(self.staging_sharedir, 'calibre')
+--- calibre-3.44.0/src/calibre/linux.py~ 2019-06-09 19:23:04.000000000 +0200
++++ calibre-3.44.0/src/calibre/linux.py 2019-06-09 19:27:46.476130247 +0200
+@@ -685,10 +685,10 @@
+ self.warn = self.warning
+
+ if not self.opts.staging_bindir:
+- self.opts.staging_bindir = os.path.join(self.opts.staging_root,
++ self.opts.staging_bindir = os.path.join(self.opts.staging_root, 'usr',
+ 'bin')
+ if not self.opts.staging_sharedir:
+- self.opts.staging_sharedir = os.path.join(self.opts.staging_root,
++ self.opts.staging_sharedir = os.path.join(self.opts.staging_root, 'usr',
+ 'share', 'calibre')
+ self.opts.staging_etc = '/etc' if self.opts.staging_root == '/usr' else \
+ os.path.join(self.opts.staging_root, 'etc')
+@@ -696,7 +696,7 @@
+ prefix = getattr(self.opts, 'prefix', None)
+ if prefix and prefix != self.opts.staging_root:
+ self.opts.staged_install = True
+- os.environ['XDG_DATA_DIRS'] = os.path.join(self.opts.staging_root, 'share')
++ os.environ['XDG_DATA_DIRS'] = os.path.join(self.opts.staging_root, 'usr', 'share')
+ os.environ['XDG_UTILS_INSTALL_MODE'] = 'system'
+
+ from calibre.utils.serialize import msgpack_loads
diff --git a/desktop-integration.patch b/desktop-integration.patch
index c22d12b..5daf2f5 100644
--- a/desktop-integration.patch
+++ b/desktop-integration.patch
@@ -4,8 +4,8 @@
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', str(size), filename, basename]
-+ cmd = ['xdg-icon-resource', 'install', '--noupdate', '--novendor', '--context', context, '--size', str(size), filename, basename]
+- 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)
@@ -18,15 +18,13 @@
cc(' '.join(cmd), shell=True)
self.menu_resources.append(x)
ak = x.partition('.')[0]
-@@ -856,10 +856,9 @@
- ak = x.partition('.')[0]
- if ak in APPDATA and os.access(appdata, os.W_OK):
- self.appdata_resources.append(write_appdata(ak, APPDATA[ak], appdata, translators))
-- cc(['xdg-desktop-menu', 'forceupdate'])
- MIME = P('calibre-mimetypes.xml')
- self.mime_resources.append(MIME)
-- cc(['xdg-mime', 'install', MIME])
-+ cc(['xdg-mime', 'install', '--novendor', MIME])
- except Exception:
- if self.opts.fatal_errors:
- raise
+@@ -856,8 +856,7 @@
+ 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/shebang-python-fix.patch b/shebang-python-fix.patch
index a03d246..163ff90 100644
--- a/shebang-python-fix.patch
+++ b/shebang-python-fix.patch
@@ -12,7 +12,7 @@
__appname__, __version__
HEADER = '''\
--#!/usr/bin/env python2
+-#!/usr/bin/env python{py_major_version}
+#!/usr/bin/env python
"""
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/calibre.git/commitdiff/7b172d7ef41f70ee87d0bd82d615db011e4ce7cb
More information about the pld-cvs-commit
mailing list