# Maintainer (Arch): Jelle van der Waa # Maintainer (Arch): Eli Schwartz # Contributor (Arch): Daniel Wallace # Contributor (Arch): Giovanni Scafora # Contributor (Arch): Petrov Roman # Contributor (Arch): Andrea Fagiani # Contributor (Arch): Larry Hajali # Maintainer: Andreas Grapentin # Contributor: David P. # Contributor: Jesús E. # Contributor: Isaac David # Contributor: David Palma # parabola changes and rationale: # - removed decrompession engine for rar archives pkgname=calibre pkgver=3.46.0 pkgrel=1 pkgrel+=.par1 pkgdesc="Ebook management application" pkgdesc+=", without nonfree decompression engine for RAR archives" arch=('x86_64') arch+=('i686' 'armv7h') url="https://calibre-ebook.com/" license=('GPL3') _py_deps=('apsw' 'beautifulsoup4' 'cssselect' 'css-parser' 'dateutil' 'dbus' 'dnspython' 'dukpy' 'feedparser' 'html2text' 'html5-parser' 'lxml' 'markdown' 'mechanize' 'msgpack' 'netifaces' 'pillow' 'psutil' 'pygments' 'pyqt5' 'regex') depends=('chmlib' 'icu' 'jxrlib' 'libmtp' 'libusbx' 'libwmf' 'mathjax' 'mtdev' 'optipng' 'podofo' "${_py_deps[@]/#/python2-}" 'qt5-svg' 'qt5-webkit' 'udisks2') makedepends=('qt5-x11extras' 'rapydscript-ng' 'sip' 'xdg-utils') checkdepends=('xorg-server-xvfb') optdepends=('ipython2: to use calibre-debug' 'poppler: required for converting pdf to html') source=("https://download.calibre-ebook.com/${pkgver}/calibre-${pkgver}.tar.xz" "https://calibre-ebook.com/signatures/${pkgname}-${pkgver}.tar.xz.sig" 'libre.patch') sha256sums=('e947b9854f9db344ee07e5495feaad759c96936d89a128d3a3587c3503d09ab6' 'SKIP' '1574e2094ce7f3e37116215ae117ed4a10426592535b261f66eacc1508566ad2') b2sums=('5590ba422d0323ea7c0cea67d88d448f00f5a470e7a8fdf9851b488c0856c88175bd107715a856706e95b2e1a45604713d061f4a7a3603ecaa01dfc018c1ed58' 'SKIP' '45a57037ad9f9b57c73e5eed8a5faf57e2be2bfdc6f4c2ff753cc536d5f8f8431d6cc9a8d64781caab47571d45fdb4476f1fecf0e759d388ca526ad36803c19b') validpgpkeys=('3CE1780F78DD88DF45194FD706BC317B515ACE7C') # Kovid Goyal (New longer key) prepare(){ cd "${pkgname}-${pkgver}" # fix freedom issues rm -v imgsrc/mimetypes/rar.svg rm -v src/calibre/ebooks/metadata/rar.py rm -v src/calibre/utils/unrar.py rm -v resources/images/mimetypes/{cbr,rar}.png patch -fNp1 -i "$srcdir/libre.patch" # Desktop integration (e.g. enforce arch defaults) sed -e "/import config_dir/,/os.rmdir(config_dir)/d" \ -e "s/'ctc-posml'/'text' not in mt and 'pdf' not in mt and 'xhtml'/" \ -e "s/^Name=calibre/Name=Calibre/g" \ -i src/calibre/linux.py # cherry-picked bits of python2-backports.functools_lru_cache # needed for frozen builds + beautifulsoup4 # see https://github.com/kovidgoyal/calibre/commit/b177f0a1096b4fdabd8772dd9edc66662a69e683#commitcomment-33169700 rm -r src/backports cd resources # Remove unneeded files rm ${pkgname}-portable.* mozilla-ca-certs.pem # tarball cache from calibre 4.x rm editor.js viewer.{js,html} # use system mathjax rm -r mathjax } build() { cd "${pkgname}-${pkgver}" LANG='en_US.UTF-8' python2 setup.py build LANG='en_US.UTF-8' python2 setup.py gui LANG='en_US.UTF-8' python2 setup.py mathjax --path-to-mathjax /usr/share/mathjax --system-mathjax LANG='en_US.UTF-8' python2 setup.py rapydscript } check() { cd "${pkgname}-${pkgver}" # without xvfb-run this fails with much "Control socket failed to recv(), resetting" # ERROR: test_websocket_perf (calibre.srv.tests.web_sockets.WebSocketTest) LANG='en_US.UTF-8' xvfb-run python2 setup.py test } package() { cd "${pkgname}-${pkgver}" # If this directory doesn't exist, zsh completion won't install. install -d "${pkgdir}/usr/share/zsh/site-functions" LANG='en_US.UTF-8' python2 setup.py install \ --staging-root="${pkgdir}/usr" \ --prefix=/usr cp -a man-pages/ "${pkgdir}/usr/share/man" # not needed at runtime rm -r "${pkgdir}"/usr/share/calibre/rapydscript/ # Compiling bytecode FS#33392 # This is kind of ugly but removes traces of the build root. while read -rd '' _file; do _destdir="$(dirname "${_file#${pkgdir}}")" python2 -m compileall -d "${_destdir}" "${_file}" python2 -O -m compileall -d "${_destdir}" "${_file}" done < <(find "${pkgdir}"/usr/lib/ -name '*.py' -print0) }