Files
MINGW-packages/mingw-w64-python3-ipython/PKGBUILD
Dan Yeaw fddd9ee6c6 Use current path prefix to find Python script files to modify
When using pacman to install packages, the --root option can be set to
install them to an alternative location. The current install scripts
don't take this in to account which causes no such file or directory
errors. This modifies the sed command to use the full prefix path
when renaming the shebang.

Signed-off-by: Dan Yeaw <dan@yeaw.me>
2019-03-27 13:02:27 -04:00

92 lines
3.6 KiB
Bash

# Maintainer: Kyle Kauffman <kyle.j.kauffman@gmail.com>
_realname=ipython
pkgbase=mingw-w64-python3-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=7.3.0
pkgrel=2
pkgdesc="An enhanced Interactive Python shell (mingw-w64)"
arch=('any')
url="https://ipython.org/"
license=('BSD')
# Mote: prompt_toolkit 2.0 is required for this series. There
# is some breakage between prompt_toolkit 1.0 and 2.0.
depends=('winpty'
"${MINGW_PACKAGE_PREFIX}-sqlite3"
"${MINGW_PACKAGE_PREFIX}-python3-jedi"
"${MINGW_PACKAGE_PREFIX}-python3-decorator"
"${MINGW_PACKAGE_PREFIX}-python3-pickleshare"
"${MINGW_PACKAGE_PREFIX}-python3-simplegeneric"
"${MINGW_PACKAGE_PREFIX}-python3-traitlets"
"${MINGW_PACKAGE_PREFIX}-python3-prompt_toolkit>=2.0"
"${MINGW_PACKAGE_PREFIX}-python3-pygments"
"${MINGW_PACKAGE_PREFIX}-python3-simplegeneric"
"${MINGW_PACKAGE_PREFIX}-python3-backcall"
"${MINGW_PACKAGE_PREFIX}-python3-pexpect"
"${MINGW_PACKAGE_PREFIX}-python3-colorama"
"${MINGW_PACKAGE_PREFIX}-python3-win_unicode_console")
# new optional thing: ipyparallel
optdepends=("${MINGW_PACKAGE_PREFIX}-python3-nose: for IPython's test suite"
"${MINGW_PACKAGE_PREFIX}-python3-qtconsole: for ipython qtconsole"
"${MINGW_PACKAGE_PREFIX}-python3-ipython-ipyparallel: for IPython.parallel")
makedepends=("${MINGW_PACKAGE_PREFIX}-python3-setuptools")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python3-requests"
"${MINGW_PACKAGE_PREFIX}-python3-testpath"
"${MINGW_PACKAGE_PREFIX}-python3-pygments"
"${MINGW_PACKAGE_PREFIX}-python3-jupyter-nbformat"
"${MINGW_PACKAGE_PREFIX}-python3-ipykernel"
"${MINGW_PACKAGE_PREFIX}-python3-numpy")
install=${_realname}3-${CARCH}.install
source=("${_realname}-${pkgver}.tar.gz::https://github.com/ipython/ipython/archive/${pkgver}.tar.gz")
sha256sums=('16fd37dfef72685c1738bb4e609cb3304bc1be41b28eca8f85c1c7485dc0d9ea')
prepare() {
cd "${srcdir}"
rm -rf python3-build-${CARCH} | true
cp -r "${_realname}-${pkgver}" "python3-build-${CARCH}"
}
build() {
msg "Python 3 build for ${CARCH}"
cd "${srcdir}/python3-build-${CARCH}"
${MINGW_PREFIX}/bin/python3 setup.py build
}
check() {
msg "Python 3 test for ${CARCH}"
cd "${srcdir}/python3-build-${CARCH}"
${MINGW_PREFIX}/bin/python3 -m test || warning "Tests fail"
}
package() {
cd "${srcdir}/python3-build-${CARCH}"
# see https://github.com/ipython/ipython/issues/2057
#export LC_ALL=en_US.UTF-8
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python3 setup.py install \
--prefix=${MINGW_PREFIX} --root=${pkgdir} --optimize=1 --skip-build
find "${pkgdir}/" -name "*.pyc" -delete
find "${pkgdir}/" -type d -empty -delete
# setuptools doesnt see mingw-w64-python's readline
find "${pkgdir}/" -name 'requires.txt' -delete
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX})
for _f in "${pkgdir}${MINGW_PREFIX}"/bin/*.cmd; do
sed -e "s|${PREFIX_WIN}/bin/||g" -i ${_f}
done
# For the command to work on the bash prompt, you must use
# winpty so include that in the Shebang before the python command.
# I don't like this but what I like really doesn't matter.
for _f in iptest iptest3 ipython ipython3; do
sed -e "s|/usr/bin/env |${MINGW_PREFIX}/|g" \
-e "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" \
-e "s|#!|#!winpty |" -i "${pkgdir}${MINGW_PREFIX}/bin/${_f}"
done
install -Dm644 docs/source/about/license_and_copyright.rst "${pkgdir}${MINGW_PREFIX}/share/licenses/ipython/LICENSE"
}