pkgbase=ipython pkgname=('ipython3' 'ipython2') pkgver=5.2.2 pkgrel=1 pkgdesc="An enhanced Interactive Python shell." arch=('any') url="http://ipython.org" license=('BSD') makedepends=('python3' 'python2' 'python3-setuptools' 'python2-setuptools' 'python3-pip' 'python2-pip') optdepends=("python3-nose: for IPython's test suite") source=("ipython-$pkgver.tgz::https://github.com/ipython/ipython/archive/$pkgver.tar.gz" "requirements_py3.txt" "requirements_py2.txt" "ipython.png" "ipython3.desktop" "ipython2.desktop") sha256sums=('bd71e823177463706f23c586496486ced983f92cad83c2911482137a4c2a0baf' '9e4a7f35ccc98489042f16514b93a92f2f0ff2075a3e6f82ef2e84d864ee24b9' '69149ad9a2837462b75cd262fb705154a9c2e117c9cf0771e3c1be13950f6e8a' '6dea629da7ed8ad8109029e27ec435b400e98fcd7f73a2cd00fc383f26250852' 'f849b54e68cf2f388cc36f6dbfc67f647b32dc387c24655ecd8fc38dbcffe90a' 'ce98f0066bf6fd6dfe6df0559673cc56e099da1617e7a41e854ef95b89b61bb9') prepare() { cd "$srcdir" cp -r ipython-$pkgver ipython2-$pkgver # python 3.5 does not need a 3.3 backport hack cd "$srcdir/ipython-$pkgver" sed -i 's|backports.shutil_get_terminal_size|shutil|' IPython/utils/terminal.py } package_ipython3() { depends=('python3' 'python3-decorator' 'python3-pexpect' 'sqlite3' 'python3-setuptools') # install deps pip3 install --target="${pkgdir}/usr/share/ipython3/modules/site-packages" -r $srcdir/requirements_py3.txt # install ipython cd "$srcdir/ipython-$pkgver" python3 setup.py install --prefix=/usr --root="$pkgdir" --optimize=0 # put wrapper on /usr/bin mkdir -p ${srcdir}/${pkgname}-bin for py in "$pkgdir/usr/bin/"* do py=${py##*/} # strip the file path and keep only the file name (e.g. /usr/bin/foo -> foo) echo "#!/bin/sh export PYTHONPATH=${PYTHONPATH}:/usr/share/${pkgname}/modules/site-packages /usr/share/${pkgname}/$py " '"${@}"' > "${srcdir}/${pkgname}-bin/$py" chmod 755 ${srcdir}/${pkgname}-bin/$py done mv ${pkgdir}/usr/bin/* ${pkgdir}/usr/share/${pkgname} mv ${srcdir}/${pkgname}-bin/* ${pkgdir}/usr/bin # .desktop and icon install -Dm644 $srcdir/ipython3.desktop "$pkgdir/usr/share/applications/ipython3.desktop" install -Dm644 "$srcdir/ipython.png" "$pkgdir/usr/share/pixmaps/ipython3.png" # license cd "$srcdir/ipython-$pkgver" install -Dm644 docs/source/about/license_and_copyright.rst "$pkgdir/usr/share/licenses/ipython3/LICENSE" } package_ipython2() { pkgdesc="An enhanced Interactive Python2 shell." depends=('python2' 'python2-decorator' 'python2-pexpect' 'sqlite3' 'python2-setuptools') optdepends=("python2-nose: for IPython's test suite") # install deps pip2 install --target="${pkgdir}/usr/share/ipython2/modules/site-packages" -r $srcdir/requirements_py2.txt # install ipython cd "$srcdir/ipython2-$pkgver" python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=0 # hack to get around ipython collision cd "$pkgdir/usr/share/man/man1/" for i in *; do mv $i ${i/%.1/2.1} done find "$pkgdir/usr/bin/" -type f -regex '.*[^2]$' -delete # put wrapper on /usr/bin mkdir -p ${srcdir}/${pkgname}-bin for py in "$pkgdir/usr/bin/"* do py=${py##*/} # strip the file path and keep only the file name (e.g. /usr/bin/foo -> foo) echo "#!/bin/sh export PYTHONPATH=${PYTHONPATH}:/usr/share/${pkgname}/modules/site-packages /usr/share/${pkgname}/$py " '"${@}"' > "${srcdir}/${pkgname}-bin/$py" chmod 755 ${srcdir}/${pkgname}-bin/$py done mv ${pkgdir}/usr/bin/* ${pkgdir}/usr/share/${pkgname} mv ${srcdir}/${pkgname}-bin/* ${pkgdir}/usr/bin # .desktop and icon install -Dm644 $srcdir/ipython2.desktop "$pkgdir/usr/share/applications/ipython2.desktop" install -Dm644 "$srcdir/ipython.png" "$pkgdir/usr/share/pixmaps/ipython2.png" # license cd "$srcdir/ipython2-$pkgver" install -Dm644 docs/source/about/license_and_copyright.rst "$pkgdir/usr/share/licenses/ipython2/LICENSE" }