summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorEli Schwartz2019-04-24 14:57:37 -0400
committerEli Schwartz2019-04-24 14:57:37 -0400
commit64c72ac4edb7eddbc876906655073f650d84b688 (patch)
treec013adee0a1ffa2b00eb9c3e129d8a2b1e919ea9 /PKGBUILD
parentf4f1b768bee5d0104704517429e020e3da72858b (diff)
downloadaur-64c72ac4edb7eddbc876906655073f650d84b688.tar.gz
upgpkg: calibre-git 3.41.3.r27.gb42963af61-1
add python3 split package
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD75
1 files changed, 59 insertions, 16 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 96bf9371cf60..d93a2f7a3ac7 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -8,8 +8,9 @@
# All my PKGBUILDs are managed at https://github.com/eli-schwartz/pkgbuilds
-pkgname=calibre-git
-pkgver=3.40.1.r146.g390b0d45c1
+pkgbase=calibre-git
+pkgname=(calibre-git calibre-python3-git)
+pkgver=3.41.3.r27.gb42963af61
pkgrel=1
pkgdesc="Ebook management application"
arch=('i686' 'x86_64')
@@ -18,16 +19,15 @@ license=('GPL3')
_py_deps=('apsw' 'beautifulsoup4' 'cssselect' 'css-parser' 'dateutil' 'dbus' 'dnspython' 'dukpy'
'feedparser' 'html2text' 'html5-parser' 'lxml' 'markdown' 'mechanize' 'msgpack'
'netifaces' 'unrardll' 'pillow' 'psutil' 'pygments' 'pyqt5' 'regex')
+_py3_deps=("${_py_deps[@]}" 'zeroconf')
depends=('chmlib' 'icu' 'jxrlib' 'libmtp' 'libusbx' 'libwmf' 'mathjax' 'mtdev' 'optipng'
- 'podofo' "${_py_deps[@]/#/python2-}" 'qt5-svg' 'qt5-webkit' 'udisks2')
-makedepends=('git' 'qt5-x11extras' 'sip' 'xdg-utils' 'rapydscript-ng') #'python2-sphinx')
+ 'podofo' 'qt5-svg' 'qt5-webkit' 'udisks2')
+makedepends=('git' "${_py_deps[@]/#/python2-}" "${_py3_deps[@]/#/python-}" 'qt5-x11extras'
+ 'sip' 'xdg-utils' 'rapydscript-ng') #'python2-sphinx')
checkdepends=('xorg-server-xvfb')
-optdepends=('ipython2: to use calibre-debug'
- 'poppler: required for converting pdf to html')
-provides=("${pkgname%-git}")
-conflicts=("${pkgname%-git}")
-source=("git+https://github.com/kovidgoyal/${pkgname%-git}.git?signed"
- "git+https://github.com/kovidgoyal/${pkgname%-git}-translations.git?signed"
+optdepends=('poppler: required for converting pdf to html')
+source=("git+https://github.com/kovidgoyal/${pkgbase%-git}.git?signed"
+ "git+https://github.com/kovidgoyal/${pkgbase%-git}-translations.git?signed"
"user-agent-data.json")
sha256sums=('SKIP'
'SKIP'
@@ -35,12 +35,12 @@ sha256sums=('SKIP'
validpgpkeys=('3CE1780F78DD88DF45194FD706BC317B515ACE7C') # Kovid Goyal (New longer key) <kovid@kovidgoyal.net>
pkgver() {
- cd "${srcdir}/${pkgname%-git}"
+ cd "${srcdir}/${pkgbase%-git}"
git describe --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare(){
- cd "${srcdir}/${pkgname%-git}"
+ cd "${srcdir}/${pkgbase%-git}"
# Link translations to build dir
ln -sfT ../calibre-translations translations
@@ -53,10 +53,15 @@ prepare(){
-e "/cc(\['xdg-mime', 'install', MIME\])/d" \
-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
}
build() {
- cd "${srcdir}/${pkgname%-git}"
+ cd "${srcdir}/${pkgbase%-git}"
# Don't use the bootstrapper, since it tries to checkout/pull the
# translations repo and generally touch the internet. Instead call each
@@ -70,6 +75,8 @@ build() {
LANG='en_US.UTF-8' python2 setup.py gui
LANG='en_US.UTF-8' python2 setup.py resources --path-to-mathjax /usr/share/mathjax --system-mathjax
+ LANG='en_US.UTF-8' CALIBRE_PY3_PORT=1 python3 setup.py build
+
# manpages simply don't build at the moment:
# https://github.com/sphinx-doc/sphinx/issues/5150
#LANG='en_US.UTF-8' python2 setup.py man_pages
@@ -81,15 +88,21 @@ build() {
}
check() {
- cd "${srcdir}/${pkgname%-git}"
+ cd "${srcdir}/${pkgbase%-git}"
# 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
+ LANG='en_US.UTF-8' xvfb-run env CALIBRE_PY3_PORT=1 python3 setup.py test
}
-package() {
- cd "${srcdir}/${pkgname%-git}"
+package_calibre-git() {
+ depends+=("${_py_deps[@]/#/python2-}")
+ optdepends+=('ipython2: to use calibre-debug')
+ provides=("${pkgname%-git}")
+ conflicts=("${pkgname%-git}")
+
+ cd "${srcdir}/${pkgbase%-git}"
# If these directories don't exist, zsh completion, icons, and desktop files won't install.
install -d "${pkgdir}/usr/share/zsh/site-functions" \
@@ -101,6 +114,7 @@ package() {
XDG_DATA_DIRS="${pkgdir}/usr/share" LANG='en_US.UTF-8' python2 setup.py install \
--staging-root="${pkgdir}/usr" \
--prefix=/usr
+ rm -r "${pkgdir}"/usr/lib/calibre/calibre/plugins/3/
#cp -a man-pages/ "${pkgdir}/usr/share/man"
@@ -118,3 +132,32 @@ package() {
python2 -O -m compileall -d "${_destdir}" "${_file}"
done < <(find "${pkgdir}"/usr/lib/ -name '*.py' -print0)
}
+
+package_calibre-python3-git() {
+ depends+=("${_py3_deps[@]/#/python-}" 'calibre-git')
+ optdepends+=('ipython: to use calibre-debug')
+ provides=("${pkgname%-git}")
+ conflicts=("${pkgname%-git}")
+
+ cd "${srcdir}/${pkgbase%-git}"
+
+ LANG='en_US.UTF-8' CALIBRE_PY3_PORT=1 python3 setup.py install \
+ --staging-root="${pkgdir}/usr" \
+ --prefix=/usr \
+ --no-postinstall \
+ --bindir=/opt/calibre-python3 \
+ --staging-bindir="${pkgdir}"/opt/calibre-python3
+
+ # 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}}")"
+ python3 -m compileall -d "${_destdir}" "${_file}"
+ python3 -O -m compileall -d "${_destdir}" "${_file}"
+ done < <(find "${pkgdir}"/usr/lib/ -name '*.py' -print0)
+
+ # cleanup overlapping files
+ find "${pkgdir}"/usr/lib/calibre -name \*.py -delete
+ rm -r "${pkgdir}"/usr/share
+ rm "${pkgdir}"/usr/lib/calibre/calibre/plugins/*.so
+}