From 270a5ef05bb59bd76f32fafbab6ee7787fd86fed Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Sat, 18 Oct 2014 19:37:43 +0200 Subject: [PATCH] - updated to 2.5.0 --- calibre-locales.patch | 72 ++++++++++++++++++++++++++++--------------- calibre.spec | 33 ++++++++++++-------- imagemagick-6.8.patch | 31 ------------------- qt4-private.patch | 11 ------- 4 files changed, 68 insertions(+), 79 deletions(-) delete mode 100644 imagemagick-6.8.patch delete mode 100644 qt4-private.patch diff --git a/calibre-locales.patch b/calibre-locales.patch index 7a186cd..4de67c3 100644 --- a/calibre-locales.patch +++ b/calibre-locales.patch @@ -9,15 +9,13 @@ def run(self, opts): self.iso639_errors = [] -@@ -152,8 +152,9 @@ class Translations(POT): # {{{ +@@ -152,7 +152,8 @@ class Translations(POT): # {{{ base = os.path.dirname(dest) if not os.path.exists(base): os.makedirs(base) -- self.info('\tCompiling translations for', locale) -- subprocess.check_call(['msgfmt', '-o', dest, f]) +- jobs.append(['msgfmt', '-o', dest, f]) + if self.newer(dest, f): -+ self.info('\tCompiling translations for', locale) -+ subprocess.check_call(['msgfmt', '-o', dest, f]) ++ jobs.append(['msgfmt', '-o', dest, f]) iscpo = {'bn':'bn_IN', 'zh_HK':'zh_CN'}.get(locale, locale) iso639 = self.j(self.LP_ISO_PATH, '%s.po'%iscpo) @@ -26,9 +24,9 @@ self.write_stats() - self.freeze_locales() + self.compile_user_manual_translations() def check_iso639(self, path): - from calibre.utils.localization import langnames_to_langcodes @@ -198,15 +198,6 @@ class Translations(POT): # {{{ # raise SystemExit(1) rmap[msgstr] = msgid @@ -72,7 +70,7 @@ - else: - trans = GNUTranslations(buf) - _CACHE[lang] = trans -+ p = os.path.join(mpath, 'messages.mo') ++ p = os.path.join(mpath, 'calibre.mo') + if os.path.exists(p): + trans = GNUTranslations(open(p, 'rb')) + _CACHE[lang] = trans @@ -108,13 +106,35 @@ + xlang = lang.split('_')[0] + if xlang in available_translations(): + hlang = xlang -+ if hlang is not None: -+ return messages_path(hlang) -+ return None ++ if hlang is not None: ++ return messages_path(hlang) ++ return None _lang_trans = None -@@ -114,18 +114,12 @@ def set_translators(): +@@ -99,13 +99,14 @@ + _lang_trans = None + + def get_all_translators(): +- from zipfile import ZipFile +- with ZipFile(P('localization/locales.zip', allow_user_override=False), 'r') as zf: +- for lang in available_translations(): +- mpath = get_lc_messages_path(lang) +- if mpath is not None: +- buf = cStringIO.StringIO(zf.read(mpath + '/messages.mo')) +- yield lang, GNUTranslations(buf) ++ for lang in available_translations(): ++ mpath = get_lc_messages_path(lang) ++ if mpath is not None: ++ try: ++ buf = open(os.path.join(mpath, 'calibre.mo'), 'rb') ++ except: ++ pass ++ yield lang, GNUTranslations(buf) + + 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()) if mpath is not None: @@ -123,19 +143,23 @@ - allow_user_override=False), 'r') as zf: - if buf is None: - buf = cStringIO.StringIO(zf.read(mpath + '/messages.mo')) -- if mpath == 'nds': -- mpath = 'de' ++ if buf is None: ++ try: ++ buf = open(os.path.join(mpath, 'calibre.mo'), 'rb') ++ except: ++ pass # No translations for this lang + if mpath == 'nds': + mpath = 'de' - isof = mpath + '/iso639.mo' -- try: + try: - iso639 = cStringIO.StringIO(zf.read(isof)) -- except: -- pass # No iso639 translations for this lang -+ if buf is None: -+ buf = open(os.path.join(mpath, 'calibre.mo'), 'rb') -+ mpath = mpath.replace(os.sep+'nds'+os.sep, os.sep+'de'+os.sep) -+ isof = os.path.join(mpath, 'calibre_iso639.mo') -+ if os.path.exists(isof): -+ iso639 = open(isof, 'rb') ++ iso639 = open(os.path.join(mpath, 'calibre_iso639.mo'), 'rb') + except: + pass # No iso639 translations for this lang + if buf is not None: + try: +- lcdata = cPickle.loads(zf.read(mpath + '/lcdata.pickle')) ++ lcdata = cPickle.loads(open(os.path.join(mpath, 'calibre_lcdata.pickle'))) + except: + pass # No lcdata - if buf is not None: - t = GNUTranslations(buf) diff --git a/calibre.spec b/calibre.spec index 0034a9d..04f4564 100644 --- a/calibre.spec +++ b/calibre.spec @@ -1,7 +1,6 @@ # # TODO: - rewrite generate-tarball.sh script to provide locales.zip handling (if needed) # - make separate server package with init-scripts, etc... -# - -locales.patch needs love # # NOTE: # Upstream packages some unfree fonts which we cannot redistribute, @@ -13,7 +12,7 @@ Summary: E-book converter and library management Summary(pl.UTF-8): Konwerter oraz biblioteka dla e-booków Name: calibre Version: 2.5.0 -Release: 0.1 +Release: 1 License: GPL v3+ Group: Applications/Multimedia Source0: %{name}-%{version}-nofonts.tar.xz @@ -25,8 +24,6 @@ Patch1: %{name}-no-update.patch Patch2: %{name}-env_module.patch Patch3: %{name}-locales.patch Patch4: shebang-python-fix.patch -Patch5: imagemagick-6.8.patch -Patch6: qt4-private.patch URL: http://www.calibre-ebook.com/ %define baeutifulsoup_ver 3.0.5 %define pil_ver 1.1.6 @@ -161,10 +158,8 @@ Pakiet ten dostarcza uzupełnianie nazw dla calibre w powłoce zsh. %patch0 -p1 %patch1 -p1 %patch2 -p1 -#%patch3 -p1 +%patch3 -p1 %patch4 -p1 -#patch5 -p1 -#%patch6 -p1 # 64bit target build fix %{__sed} -i -e "s!'/usr/lib'!'%{_libdir}'!g" setup/build_environment.py @@ -202,37 +197,46 @@ cp -p resources/images/viewer.png $RPM_BUILD_ROOT%{_pixmapsdir}/calibre-viewer.p %py_comp $RPM_BUILD_ROOT%{_libdir}/%{name} %py_postclean %{_libdir}/%{name} -mv $RPM_BUILD_ROOT%{_datadir}/%{name}/localization/locales $RPM_BUILD_ROOT%{_localedir} +%{__mv} $RPM_BUILD_ROOT%{_datadir}/%{name}/localization/locales $RPM_BUILD_ROOT%{_localedir} # set proper filenames for locales (TODO: switch to patch if possible) for file in $RPM_BUILD_ROOT%{_localedir}/*; do lang=$(echo $file|%{__sed} 's:.*locale/\(.*\).*:\1:') mkdir $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES mv $RPM_BUILD_ROOT%{_localedir}/$lang/*.mo \ - $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES + $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES done; for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/messages.mo; do lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:') mv $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/messages.mo \ - $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}.mo + $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}.mo done; for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/iso639.mo; do lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:') mv $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/iso639.mo \ - $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}_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 # unsupported -%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/ber %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/jv %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/ltg %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/en_AU +%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/sl_SI 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:') + echo $file | %{__sed} "s:$RPM_BUILD_ROOT\(.*\):%lang($lang) \1:" >>%{name}.lang +done; %clean rm -rf $RPM_BUILD_ROOT @@ -274,6 +278,9 @@ fi %attr(755,root,root) %{_bindir}/markdown-calibre %attr(755,root,root) %{_bindir}/web2disk %{_datadir}/%{name} +%{_datadir}/appdata/calibre-ebook-edit.appdata.xml +%{_datadir}/appdata/calibre-ebook-viewer.appdata.xml +%{_datadir}/appdata/calibre-gui.appdata.xml %{_libdir}/%{name} %{_desktopdir}/calibre-ebook-edit.desktop %{_desktopdir}/calibre-ebook-viewer.desktop @@ -288,7 +295,7 @@ fi %files -n bash-completion-calibre %defattr(644,root,root,755) -%{_sysconfdir}/bash_completion.d/* +%{bash_compdir}/calibre %files -n zsh-completion-calibre %defattr(644,root,root,755) diff --git a/imagemagick-6.8.patch b/imagemagick-6.8.patch deleted file mode 100644 index a700d8f..0000000 --- a/imagemagick-6.8.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- calibre/setup/build_environment.py~ 2013-06-14 14:05:26.545918167 +0200 -+++ calibre/setup/build_environment.py 2013-06-14 14:08:05.417786156 +0200 -@@ -148,7 +148,7 @@ - # Include directories - png_inc_dirs = pkgconfig_include_dirs('libpng', 'PNG_INC_DIR', - '/usr/include') -- magick_inc_dirs = pkgconfig_include_dirs('MagickWand', 'MAGICK_INC', '/usr/include/ImageMagick') -+ magick_inc_dirs = pkgconfig_include_dirs('MagickWand', 'MAGICK_INC', '/usr/include/ImageMagick-6') - - # Library directories - png_lib_dirs = pkgconfig_lib_dirs('libpng', 'PNG_LIB_DIR', '/usr/lib64') ---- calibre/src/calibre/utils/magick/generate.py~ 2013-06-14 04:43:40.000000000 +0200 -+++ calibre/src/calibre/utils/magick/generate.py 2013-06-14 14:08:45.158252817 +0200 -@@ -7,7 +7,7 @@ - - import os, textwrap, re, subprocess - --INC = '/usr/include/ImageMagick' -+INC = '/usr/include/ImageMagick-6' - - ''' - Various constants defined in the ImageMagick header files. Note that -@@ -42,7 +42,7 @@ - '''%const - with open('/tmp/ig.c','wb') as f: - f.write(t) -- subprocess.check_call(['gcc', '-I/usr/include/ImageMagick', '/tmp/ig.c', '-o', '/tmp/ig', '-lMagickWand']) -+ subprocess.check_call(['gcc', '-I/usr/include/ImageMagick-6', '/tmp/ig.c', '-o', '/tmp/ig', '-lMagickWand']) - return int(subprocess.Popen(["/tmp/ig"], - stdout=subprocess.PIPE).communicate()[0].strip()) - diff --git a/qt4-private.patch b/qt4-private.patch deleted file mode 100644 index a937c04..0000000 --- a/qt4-private.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- calibre/setup/build_environment.py~ 2013-06-14 14:10:30.722824622 +0200 -+++ calibre/setup/build_environment.py 2013-06-14 14:15:07.539397931 +0200 -@@ -82,7 +82,7 @@ - pyqt = pyqtconfig.Configuration() - - qt_inc = pyqt.qt_inc_dir --qt_private_inc = [] -+qt_private_inc = [ '/usr/include/qt4/private/include/QtGui', '/usr/include/qt4/private/include/QtCore' ] - qt_lib = pyqt.qt_lib_dir - ft_lib_dirs = [] - ft_libs = [] -- 2.44.0