void-packages/srcpkgs/python-ipython/template

136 lines
4.2 KiB
Bash

# Template file for 'python-ipython'
pkgname=python-ipython
version=3.0.0
revision=1
noarch=yes
wrksrc="ipython-${version}"
build_style=python-module
python_versions="2.7 3.4"
hostmakedepends="
python-setuptools python3.4-setuptools python-Sphinx python3.4-Sphinx
python-Pygments python3.4-Pygments python-tornado python3.4-tornado
python-Jinja2 python3.4-Jinja2 python-pyzmq python3.4-pyzmq python-pexpect
python3.4-pexpect"
makedepends="${hostmakedepends}"
depends="python-decorator python-path python-pexpect python-simplegeneric"
pycompile_module="IPython"
short_desc="Enhanced interactive Python2 shell"
_short_desc="${short_desc/Python2/Python3.4}"
maintainer="Alessio Sergi <al3hex@gmail.com>"
homepage="http://ipython.org/"
license="3-clause-BSD"
distfiles="${PYPI_SITE}/i/ipython/ipython-${version}.tar.gz"
checksum=86070141110101b6b55e6dc31a40461c437d391a5337a6e5e349357dc18bfbb4
# explicit order, do not change
subpackages="python-ipython-notebook python3.4-ipython-notebook python3.4-ipython"
if [ -z "$CROSS_BUILD" ]; then
subpackages+=" python-ipython-qtconsole python3.4-ipython-qtconsole"
fi
pre_build() {
# remove shebangs
find IPython -type f -name '*.py' -exec sed -i '/^#!.*python$/d' {} +
# rename man pages
for f in docs/man/*; do
cp ${f} ${f/%.1/3.1}
done
}
post_install() {
# remove bundled libraries
for f in decorator{,s} path pexpect simplegeneric; do
find ${DESTDIR} -type f -name _${f}.py -delete
done
# remove qtconsole
rm -rf ${DESTDIR}/usr/lib/python*/site-packages/IPython/qt
# use system mathjax
for pyver in $python_versions; do
ln -sf /usr/share/mathjax \
${DESTDIR}/usr/lib/python${pyver}/site-packages/IPython/html/static/mathjax
done
# drop '2' suffix from bin names
for f in ${DESTDIR}/usr/bin/*2; do
mv ${f} ${f/%2/}
done
# install qtconsole.desktop files
if [ -z "$CROSS_BUILD" ]; then
install -Dm644 "${wrksrc}/examples/IPython Kernel/ipython-qtconsole.desktop" \
${DESTDIR}/usr/share/applications/ipython-qtconsole.desktop
sed -i 's/ipython/&3/g;s/IPython/&3/g' \
"${wrksrc}/examples/IPython Kernel/ipython-qtconsole.desktop"
install -Dm644 "${wrksrc}/examples/IPython Kernel/ipython-qtconsole.desktop" \
${DESTDIR}/usr/share/applications/ipython3-qtconsole.desktop
fi
# install license
vlicense COPYING.rst LICENSE
}
python-ipython-notebook_package() {
noarch=yes
depends="${sourcepkg}-${version}_${revision} python-pyzmq python-Jinja2
python-tornado python-jsonschema python-Pygments python-mistune
python-terminado mathjax"
short_desc+=" - HTML notebook"
pycompile_module="IPython"
pkg_install() {
vmove usr/lib/python2.7/site-packages/IPython/html
}
}
python-ipython-qtconsole_package() {
noarch=yes
depends="${sourcepkg}-${version}_${revision} python-pyzmq python-Pygments
python-PyQt4 desktop-file-utils"
short_desc+=" - Qt console"
pycompile_module="IPython"
pkg_install() {
vmkdir usr/lib/python2.7/site-packages/IPython
vcopy ${wrksrc}/IPython/qt usr/lib/python2.7/site-packages/IPython
vmove usr/share/applications/ipython-qtconsole.desktop
}
}
python3.4-ipython_package() {
noarch=yes
depends="python3.4-decorator python3.4-path python3.4-pexpect
python3.4-simplegeneric"
short_desc="${_short_desc}"
pycompile_version="3.4"
pycompile_module="IPython"
pkg_install() {
vmove usr/bin/*3
vmove usr/lib/python3.4
vmove usr/share/man/man1/*3.1
vlicense COPYING.rst LICENSE
}
}
python3.4-ipython-notebook_package() {
noarch=yes
depends="python3.4-ipython-${version}_${revision} python3.4-pyzmq
python3.4-Jinja2 python3.4-tornado python3.4-jsonschema python3.4-Pygments
python3.4-mistune python3.4-terminado mathjax"
short_desc="${_short_desc} - HTML notebook"
pycompile_version="3.4"
pycompile_module="IPython"
pkg_install() {
vmove usr/lib/python3.4/site-packages/IPython/html
}
}
python3.4-ipython-qtconsole_package() {
noarch=yes
depends="python3.4-ipython-${version}_${revision} python3.4-pyzmq
python3.4-Pygments python3.4-PyQt4 desktop-file-utils"
short_desc="${_short_desc} - Qt console"
pycompile_version="3.4"
pycompile_module="IPython"
pkg_install() {
vmkdir usr/lib/python3.4/site-packages/IPython
vcopy ${wrksrc}/IPython/qt usr/lib/python3.4/site-packages/IPython
vmove usr/share/applications/ipython3-qtconsole.desktop
}
}