core/sage-notebook/repos/community-any/PKGBUILD

72 lines
2.4 KiB
Bash
Raw Normal View History

2015-04-13 15:59:57 +08:00
# $Id$
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Maintainer: Evgeniy Alekseev <arcanis.arch at gmail dot com>
pkgname=sage-notebook
pkgver=0.11.4
pkgrel=2
pkgdesc='Browser-based notebook interface for Sage'
arch=(any)
url='http://www.sagemath.org'
license=(GPL3)
depends=(sage-mathematics python2-twisted python2-flask-oldsessions python2-flask-openid python2-flask-autoindex python2-flask-babel
python2-webassets mathjax)
optdepends=('python2-pyopenssl: to use the notebook in secure mode')
makedepends=(gendesk)
source=("https://github.com/sagemath/sagenb/archive/$pkgver.tar.gz" 'sage.service' 'jmol.patch')
install=$pkgname.install
md5sums=('e8e0495d3668735c4ec2abc157c17f6b'
'61620179a7ecd85401d8e5a6ece3ea41'
'b29760c97a5328faa179a46008391bf0')
prepare() {
# create *.desktop file
gendesk -f -n \
--pkgname="sage-notebook" \
--pkgdesc="Sage notebook" \
--name="Sage" \
--exec="/usr/bin/sage -notebook" \
--terminal=true \
--categories="Education;Science;Math" \
--custom="X-DCOP-ServiceType=
X-KDE-SubstituteUID=false
X-KDE-Username="
cd sagenb-$pkgver
# Use python2
find -name '*.py' | xargs sed -e 's|#! /usr/bin/python|#! /usr/bin/python2|' -e 's|#!/usr/bin/python|#!/usr/bin/python2|' \
-e 's|#!/usr/bin/env python|#!/usr/bin/env python2|' -i
sed -e 's|python %s|python2 %s|' -i sagenb/notebook/run_notebook.py
sed -e "s|python = 'python'|python = 'python2'|" -i sagenb/interfaces/expect.py
# fix displaying 3D plots
patch -p0 -i "$srcdir"/jmol.patch
}
build() {
cd sagenb-${pkgver}
python2 setup.py build
}
package() {
cd sagenb-${pkgver}
python2 setup.py install --root "$pkgdir" --optimize=1
install -D -m644 COPYING "$pkgdir"/usr/share/licenses/${pkgname}/COPYING
# Use system mathjax
rm -r "$pkgdir"/usr/lib/python2.7/site-packages/sagenb/data/mathjax
ln -s /usr/share/mathjax "$pkgdir"/usr/lib/python2.7/site-packages/sagenb/data/mathjax
# install a systemd user unit
install -Dm644 "${srcdir}/sage.service" "$pkgdir/usr/lib/systemd/user/sage.service"
# install *.desktop and icon files
install -Dm644 "${srcdir}/sage-notebook.desktop" "$pkgdir/usr/share/applications/sage-notebook.desktop"
install -Dm644 "$pkgdir/usr/lib/python2.7/site-packages/sagenb/data/sage/images/icon48x48.png" \
"$pkgdir/usr/share/pixmaps/sage-notebook.png"
}