Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > 6efbbb87876d20657f94d359052b7fbd > files > 9

calibre-0.8.6-0.2.mga1.src.rpm

%define name	calibre
%define version 0.8.6
%define release %mkrel 0
%define subrel  2

Name:		%{name}
Version:	%{version}
Release:	%{release}
Summary:	E-book converter and library management
Group:		Text tools 
License:	GPLv3
URL:            http://calibre-ebook.com/
Source0:         http://calibre-ebook.googlecode.com/files/%{name}-%{version}.tar.gz
Source2:        calibre-mount-helper
Patch0:         %{name}-manpages.patch
Patch1:         %{name}-no-update-0.8.6.patch
Patch2:         %{name}-0.7.38-pyPdf-fix.patch
Patch3:         %{name}-0.7.27-python-fix.patch
Patch4:         %{name}-python2-env-fix.patch
Patch5:         %{name}-web-control.patch

BuildRequires:  python >= 2.6
BuildRequires:  python-devel >= 2.6
BuildRequires:  ImageMagick-devel
BuildRequires:  python-setuptools
BuildRequires:  qt4-devel 
BuildRequires:  python-qt4-devel
BuildRequires:  libpoppler-qt4-devel >= 0.12
BuildRequires:  podofo-devel
BuildRequires:  desktop-file-utils
BuildRequires:  python-mechanize
BuildRequires:  python-lxml
BuildRequires:  python-dateutil
BuildRequires:  python-imaging
BuildRequires:  xdg-utils
BuildRequires:  python-beautifulsoup
BuildRequires:  chmlib-devel
BuildRequires:  python-cssutils >= 0.9.6
BuildRequires:  sqlite-devel
BuildRequires:  libicu-devel
BuildRequires:  unzip
BuildRequires:  libwmf-devel

Requires:       python-qt4
Requires:       python-pypdf
Requires:       python-cherrypy
Requires:       python-cssutils
Requires:       ImageMagick
Requires:       python-odf
Requires:       python-django-tagging
Requires:       python-lxml
Requires:       python-imaging
Requires:       python-mechanize
Requires:       python-dateutil
Requires:       python-genshi
Requires:       python-beautifulsoup
Requires:       poppler
# Require the packages of the files which are symlinked by calibre
Requires:       fonts-ttf-liberation
# E-mail functionality requires this package
# see https://bugs.launchpad.net/calibre/+bug/739073
Requires:	python-dnspython


%description
Calibre is meant to be a complete e-library solution. It includes library
management, format conversion, news feeds to ebook conversion as well as
e-book reader sync features.

Calibre is primarily a ebook cataloging program. It manages your ebook
collection for you. It is designed around the concept of the logical book,
i.e. a single entry in the database that may correspond to ebooks in several
formats. It also supports conversion to and from a dozen different ebook
formats.

Supported input formats are: MOBI, LIT, PRC, EPUB, CHM, ODT, HTML, CBR, CBZ,
RTF, TXT, PDF and LRS.

%files -f %{name}.lang
%doc COPYRIGHT LICENSE Changelog.yaml
%{_bindir}/calibre
%{_bindir}/calibre-complete
%{_bindir}/calibre-customize
%{_bindir}/calibre-debug
%{_bindir}/calibre-parallel
%{_bindir}/calibre-server
%{_bindir}/calibre-smtp
%{_bindir}/calibre-mount-helper
%{_bindir}/calibredb
%{_bindir}/ebook-convert
%{_bindir}/ebook-device
%{_bindir}/ebook-meta
%{_bindir}/ebook-viewer
%{_bindir}/epub-fix
%{_bindir}/fetch-ebook-metadata
%{_bindir}/lrf2lrs
%{_bindir}/lrfviewer
%{_bindir}/lrs2lrf
%{_bindir}/markdown-calibre
%{_bindir}/pdfmanipulate
%{_bindir}/web2disk
%config(noreplace) %{_sysconfdir}/bash_completion.d/%{name}
%{_libdir}/%{name}
%{_datadir}/%{name}
%{_datadir}/pixmaps/*
%{_datadir}/applications/*.desktop
%{_datadir}/mime/packages/*
%{_datadir}/icons/hicolor/scalable/mimetypes/*
%{_datadir}/icons/hicolor/scalable/apps/*
%{python_sitelib}/init_calibre.py*
%{_mandir}/man1/*


#--------------------------------------------------------------------

%prep
%setup -q -n %{name}

# remove redundant / non-free fonts
rm -rf resources/fonts/*

# don't append calibre1 to the name of the manpages. No need to compress either
# upstream won't fix: http://oldbugs.calibre-ebook.com/ticket/3770#comment:7
%patch0 -p1 -b .manpages

# don't check for new upstream version (that's what packagers do)
# otherwise the plugins are safe to be updated in ~/.config/calibre/plugins/
%patch1 -F 2 -p1 -b .no-update

# fix crash on pdf export
# https://bugzilla.redhat.com/show_bug.cgi?id=673604
# (use the correct API for the external pyPdf library)
%patch2 -p1 -b .pdf-export-fix

# libs
%patch3 -p1 -b .python-fix

# there is no python2 symlink to python2.7
# but just python, as opposed to python3
%patch4 -p1 -b .python2-env-fix

# import from QtNetwork, not Qt
%patch5 -p1 -b .python-web-control

# 0.8.6 was rushed in and reports to be 0.8.5 in the sources
# REMOVE THIS IN FUTURE VERSIONS!
%{__sed} -i -e 's/numeric_version = (0, 8, 5)/numeric_version = (0, 8, 6)/' src/calibre/constants.py

# dos2unix newline conversion
%{__sed} -i -e 's/\r//' src/calibre/web/feeds/recipes/*

# fix the location of liberation default font
%{__sed} -i -e "s:P('fonts/liberation/LiberationSerif:('%{_datadir}/fonts/TTF/liberation/LiberationSerif:" \
  src/calibre/library/catalog.py
%{__sed} -i -e "s:P('fonts/liberation/LiberationSerif:('%{_datadir}/fonts/TTF/liberation/LiberationSerif:" \
  src/calibre/utils/magick/draw.py
%{__sed} -i -e "s:P('fonts/liberation/LiberationSerif:('%{_datadir}/fonts/TTF/liberation/LiberationSerif:" \
  src/calibre/web/feeds/news.py
%{__sed} -i -e "s:P('fonts/liberation/LiberationSerif:('%{_datadir}/fonts/TTF/liberation/LiberationSerif:" \
  recipes/*_ke.recipe

# remove shebangs
%{__sed} -i -e '/^#!\//, 1d' src/calibre/*/*/*/*.py
%{__sed} -i -e '/^#!\//, 1d' src/calibre/*/*/*.py
%{__sed} -i -e '/^#![ ]*\//, 1d' src/calibre/*/*.py
%{__sed} -i -e '/^#!\//, 1d' src/calibre/*.py
%{__sed} -i -e '/^#!\//, 1d' src/templite/*.py
%{__sed} -i -e '/^#!\//, 1d' resources/default_tweaks.py
%{__sed} -i -e '/^#!\//, 1d' recipes/*.recipe

%{__chmod} -x src/calibre/*/*/*/*.py
%{__chmod} -x src/calibre/*/*/*.py
%{__chmod} -x src/calibre/*/*.py
%{__chmod} -x src/calibre/*.py
%{__chmod} -x recipes/*.recipe

%build
OVERRIDE_CFLAGS="%{optflags}" python setup.py build 

%install
mkdir -p %{buildroot}%{_datadir}

# create directories for xdg-utils
mkdir -p %{buildroot}%{_datadir}/icons
mkdir -p %{buildroot}%{_datadir}/icons/hicolor
mkdir -p %{buildroot}%{_datadir}/packages
mkdir -p %{buildroot}%{_datadir}/mime
mkdir -p %{buildroot}%{_datadir}/mime/packages
mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/desktop-directories

# create directory for calibre environment module
# the install script assumes it's there.
mkdir -p %{buildroot}%{python_sitelib}

XDG_DATA_DIRS="%{buildroot}%{_datadir}" \
XDG_UTILS_INSTALL_MODE="system" \
LIBPATH="%{_libdir}" \
python setup.py install --root=%{buildroot}%{_prefix} \
                        --prefix=%{_prefix} \
                        --libdir=%{_libdir} \
                        --staging-libdir=%{buildroot}%{_libdir} \
# remove shebang from init_calibre.py here because
# it just got spawned by the install script
%{__sed} -i -e '/^#!\//, 1d' %{buildroot}%{python_sitelib}/init_calibre.py

# icons
mkdir -p %{buildroot}%{_datadir}/pixmaps/
cp -p resources/images/library.png                \
   %{buildroot}%{_datadir}/pixmaps/%{name}-gui.png
cp -p resources/images/viewer.png                 \
   %{buildroot}%{_datadir}/pixmaps/calibre-viewer.png

# every file is empty here
find %{buildroot}%{_datadir}/mime -maxdepth 1 -type f|xargs rm -f 

# the portable batch (>=0.8.5) is not needed
rm -f %{buildroot}%{_bindir}/calibre-portable.bat

# packages aren't allowed to register mimetypes like this
rm -f %{buildroot}%{_datadir}/applications/defaults.list
rm -f %{buildroot}%{_datadir}/applications/mimeinfo.cache

desktop-file-validate \
%{buildroot}%{_datadir}/applications/calibre-ebook-viewer.desktop
desktop-file-validate \
%{buildroot}%{_datadir}/applications/calibre-gui.desktop
desktop-file-validate \
%{buildroot}%{_datadir}/applications/calibre-lrfviewer.desktop


mv %{buildroot}%{_datadir}/mime/packages/calibre-mimetypes \
   %{buildroot}%{_datadir}/mime/packages/calibre-mimetypes.xml

# mimetype icon for lrf
rm -rf %{buildroot}%{_datadir}/icons/hicolor/128x128
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps
cp -p resources/images/mimetypes/lrf.png \
      %{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes/application-x-sony-bbeb.png
cp -p resources/images/viewer.png \
      %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/calibre-viewer.png

# don't put bash completions in /usr/etc
mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d
mv %{buildroot}%{_prefix}%{_sysconfdir}/bash_completion.d/%{name} %{buildroot}%{_sysconfdir}/bash_completion.d
rmdir %{buildroot}%{_prefix}%{_sysconfdir}/bash_completion.d

# these are provided as separate packages
rm -rf %{buildroot}%{_libdir}/%{name}/{odf,cherrypy,pyPdf,encutils,cssutils}
rm -rf %{buildroot}%{_libdir}/%{name}/cal/utils/genshi
rm -rf %{buildroot}%{_libdir}/%{name}/cal/trac

# link to system fonts after we have deleted the non-free ones
# http://oldbugs.calibre-ebook.com/ticket/3832
mkdir -p %{buildroot}%{_datadir}/%{name}/fonts/prs500
ln -s %{_datadir}/fonts/TTF/liberation/LiberationSans-Regular.ttf \
      %{buildroot}%{_datadir}/%{name}/fonts/prs500/tt0003m_.ttf
ln -s %{_datadir}/fonts/TTF/liberation/LiberationSerif-Regular.ttf \
      %{buildroot}%{_datadir}/%{name}/fonts/prs500/tt0011m_.ttf
ln -s %{_datadir}/fonts/TTF/liberation/LiberationMono-Regular.ttf \
      %{buildroot}%{_datadir}/%{name}/fonts/prs500/tt0419m_.ttf

# man pages
mkdir -p %{buildroot}%{_mandir}/man1
cp %{buildroot}%{_datadir}/%{name}/man/man1/* %{buildroot}%{_mandir}/man1

# localization has changed since calibre-0.8.5
# locale.zip is treated internally at runtime
# so the traditional locale fixes are moot.
# locales should still be looked for in the proper place
# but under the new localization zip-based schema
%{__sed} -i -e 's:localization/locale.zip:%{_datadir}/%{name}/localization/locales.zip:' %{buildroot}%{_libdir}/%{name}/%{name}/utils/localization.py  

%find_lang %{name} --with-kde --all-name

%{__rm} -f %{buildroot}%{_bindir}/%{name}-uninstall   

cp -a %{SOURCE2} %{buildroot}%{_bindir}/



%changelog

* Sun Nov 06 2011 shadow95 <shadow95> 0.8.6-0.2.mga1
+ Revision: 164553
- add missing Requires poppler (bug #2379)

  + dmorgan <dmorgan>
    - Fix file list
    - New version ( Fix start of calibre )

* Sun Mar 27 2011 blino <blino> 0.7.32-3.mga1
+ Revision: 78038
- imported package calibre


* Fri Mar 11 2011 Funda Wang <fwang@mandriva.org> 0.7.32-3mdv2011.0
+ Revision: 643736
- rebuild for new poppler

* Thu Dec 30 2010 Funda Wang <fwang@mandriva.org> 0.7.32-2mdv2011.0
+ Revision: 626152
- rebuild for new poppler

* Sat Dec 04 2010 Tomas Kindl <supp@mandriva.org> 0.7.32-1mdv2011.0
+ Revision: 609311
- update to 0.7.32

* Sun Nov 28 2010 Ahmad Samir <ahmadsamir@mandriva.org> 0.7.31-1mdv2011.0
+ Revision: 602480
- update to 0.7.31
- Make python-fix patch detect the version of python used in the chroot; this way
  one patch can be used for cooker and backports

* Sun Nov 14 2010 Ahmad Samir <ahmadsamir@mandriva.org> 0.7.27-1mdv2011.0
+ Revision: 597480
- Update to 0.7.27

* Mon Nov 01 2010 Ahmad Samir <ahmadsamir@mandriva.org> 0.7.26-1mdv2011.0
+ Revision: 591686
- update to 0.7.26
- rediff python-fix patch. Now there're two patches, one for python-2.7 for distro
  >= 2011.0 and another for python-2.6 for older stable distros (so that it can
  be backported).

* Tue Oct 26 2010 Ahmad Samir <ahmadsamir@mandriva.org> 0.7.24-1mdv2011.0
+ Revision: 589452
- update to 0.7.24

* Tue Oct 12 2010 Ahmad Samir <ahmadsamir@mandriva.org> 0.7.23-1mdv2011.0
+ Revision: 585054
- update to 0.7.23

* Thu Oct 07 2010 Matthew Dawkins <mattydaw@mandriva.org> 0.7.22-1mdv2011.0
+ Revision: 583906
- new version 0.7.22

* Sat Oct 02 2010 Ahmad Samir <ahmadsamir@mandriva.org> 0.7.21-1mdv2011.0
+ Revision: 582432
- update to 0.7.21

* Tue Sep 28 2010 Ahmad Samir <ahmadsamir@mandriva.org> 0.7.20-1mdv2011.0
+ Revision: 581851
- update to 0.7.20

* Sat Sep 18 2010 Ahmad Samir <ahmadsamir@mandriva.org> 0.7.19-1mdv2011.0
+ Revision: 579439
- update to 0.7.19

* Sun Sep 12 2010 Ahmad Samir <ahmadsamir@mandriva.org> 0.7.18-1mdv2011.0
+ Revision: 577831
- update to 0.7.18
- icons are now .png

* Mon Sep 06 2010 Buchan Milne <bgmilne@mandriva.org> 0.7.17-1mdv2011.0
+ Revision: 576247
- update to new version 0.7.17

* Wed Aug 25 2010 Ahmad Samir <ahmadsamir@mandriva.org> 0.7.15-1mdv2011.0
+ Revision: 573287
- update to 0.7.15 (and in the way rebuild for new podofo)

* Sun Aug 22 2010 Funda Wang <fwang@mandriva.org> 0.7.14-2mdv2011.0
+ Revision: 571800
- rebuild for new poppler

  + Tomas Kindl <supp@mandriva.org>
    - bump to 0.7.14

* Sun Aug 08 2010 Ahmad Samir <ahmadsamir@mandriva.org> 0.7.13-1mdv2011.0
+ Revision: 567781
- update to 0.7.13

* Fri Aug 06 2010 Ahmad Samir <ahmadsamir@mandriva.org> 0.7.12-1mdv2011.0
+ Revision: 567146
- update to 0.7.12

* Thu Aug 05 2010 Funda Wang <fwang@mandriva.org> 0.7.10-3mdv2011.0
+ Revision: 566253
- rebuild for new poppler

* Fri Jul 30 2010 Ahmad Samir <ahmadsamir@mandriva.org> 0.7.10-2mdv2011.0
+ Revision: 563265
- update manpage and no-update patches (from Fedora)
- drop SOURCE1 and python-cssutils hack, it's not needed anymore as
  python-cssutils has been updated to 0.9.7b3
- build with optflags
- delete mimeinfo.cache too

  + Juan Luis Baptiste <juancho@mandriva.org>
    - Updated to 0.7.10, redo diff calibre-no-update.patch.

* Sat Jul 10 2010 Funda Wang <fwang@mandriva.org> 0.6.54-2mdv2011.0
+ Revision: 549995
- rebuild for new imagemagick

  + Tomas Kindl <supp@mandriva.org>
    - various minor SPEC fixes and clean-ups

  + Juan Luis Baptiste <juancho@mandriva.org>
    - Updated to 0.6.54.

* Tue Apr 20 2010 Tomas Kindl <supp@mandriva.org> 0.6.48-1mdv2010.1
+ Revision: 537127
- update to 0.6.48
- fix python-odf and python-django-tagging dependency'

* Tue Apr 20 2010 Tomas Kindl <supp@mandriva.org> 0.6.47-3mdv2010.1
+ Revision: 536983
- fix incorrect odf-py require & bump release
- fix incorrect odf-py require

* Mon Apr 19 2010 Tomas Kindl <supp@mandriva.org> 0.6.47-2mdv2010.1
+ Revision: 536555
- enable PoDoFo dependency as we have PoDoFo in MDV now

* Sun Apr 18 2010 Tomas Kindl <supp@mandriva.org> 0.6.47-1mdv2010.1
+ Revision: 536529
- initial import containing all pertinent fixes to ensure it will build on Mandriva...
- create calibre