# Template file for 'python-ipython'
pkgname=python-ipython
version=5.3.0
revision=1
noarch=yes
wrksrc="ipython-${version}"
build_style=python-module
hostmakedepends="python-setuptools python3-setuptools"
depends="python-pickleshare python-simplegeneric python-traitlets python-pexpect
 python-prompt_toolkit python-Pygments python-backports.shutil_get_terminal_size"
pycompile_module="IPython"
short_desc="Enhanced interactive Python2 shell"
maintainer="Alessio Sergi <al3hex@gmail.com>"
homepage="http://ipython.org/"
license="3-clause-BSD"
distfiles="${PYPI_SITE}/i/ipython/ipython-${version}.tar.gz"
checksum=bf5e615e7d96dac5a61fbf98d9e2926d98aa55582681bea7e9382992a3f43c1d

alternatives="
 ipython:ipython:/usr/bin/ipython2
 ipython:ipython.1:/usr/share/man/man1/ipython2.1"

post_install() {
	# use decorators of numpy
	rm -f ${DESTDIR}/usr/lib/python*/site-packages/IPython/external/decorators/_decorators.py
	# remove iptest
	rm -f ${DESTDIR}/usr/bin/iptest*
	# create versioned man pages
	mv ${DESTDIR}/usr/share/man/man1/ipython{,2}.1
	vman docs/man/ipython.1 ipython3.1
	# install license
	vlicense COPYING.rst LICENSE
}

python3-ipython_package() {
	alternatives="
	 ipython:ipython:/usr/bin/ipython3
	 ipython:ipython.1:/usr/share/man/man1/ipython3.1"
	noarch=yes
	depends="python3-pickleshare python3-simplegeneric python3-traitlets
	 python3-pexpect python3-prompt_toolkit python3-Pygments"
	pycompile_module="IPython"
	replaces="python3.4-ipython>=0"
	short_desc="${short_desc/Python2/Python3}"
	pkg_install() {
		vmove usr/bin/ipython3
		vmove usr/lib/python3*
		vmove usr/share/man/man1/ipython3.1
		vlicense COPYING.rst LICENSE
	}
}
python3.4-ipython_package() {
	noarch=yes
	build_style=meta
	short_desc="${short_desc/Python2/Python3.4} (transitional dummy package)"
	depends="python3-ipython>=${version}_${revision}"
}
