Files
MINGW-packages/mingw-w64-python-babel/PKGBUILD
J. Peter Mugaas c314e3aba5 python-babel - 2.6.0 - various fixes (#4619)
* python-babel - 2.6.0 - various fixes
build separately from install
run tests
fix so pip can detect it's presence

* Attempt to fix Alex's complaint about a file not being mentioned.  It was listed later in sources.
2018-11-04 12:15:37 +03:00

120 lines
4.3 KiB
Bash

# Maintainer: Alexey Pavlov <alexpux@gmail.com>
_pyname=babel
_realname=babel
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=2.6.0
_core=33
pkgrel=3
pkgdesc="A collection of tools for internationalizing Python applications (mingw-w64)"
url="http://babel.pocoo.org/"
license=("BSD")
arch=('any')
makedepends=("${MINGW_PACKAGE_PREFIX}-python2-setuptools"
"${MINGW_PACKAGE_PREFIX}-python3-setuptools"
"${MINGW_PACKAGE_PREFIX}-python2-pytz"
"${MINGW_PACKAGE_PREFIX}-python3-pytz")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python2-pytest"
"${MINGW_PACKAGE_PREFIX}-python3-pytest"
"${MINGW_PACKAGE_PREFIX}-python2-pytest-runner"
"${MINGW_PACKAGE_PREFIX}-python3-pytest-runner"
"${MINGW_PACKAGE_PREFIX}-python2-freezegun"
"${MINGW_PACKAGE_PREFIX}-python3-freezegun")
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/python-babel/babel/archive/v${pkgver}.tar.gz"
"core-$_core.zip"::"http://unicode.org/Public/cldr/$_core/core.zip")
noextract=("core-$_core.zip")
sha256sums=('f760326e6ae6ce290520aef63c3ee416a9258d7917addb0b6e086fe0e5911432'
'fa3490082c086d21257153609642f54fcf788fcfda4966fe67f3f6daca0d58b9')
prepare() {
cd ${srcdir}
for pver in {2,3}; do
rm -rf python${pver}-build-${CARCH} | true
cp -r "${_pyname}-${pkgver}" "python${pver}-build-${CARCH}"
cp "$srcdir"/core-$_core.zip "python${pver}-build-${CARCH}"/cldr/core-$_core.0.zip
done
}
build() {
for pver in {2,3}; do
msg "Python ${pver} build for ${CARCH}"
cd "${srcdir}/python${pver}-build-${CARCH}"
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python${pver} setup.py import_cldr
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python${pver} setup.py build
done
}
check() {
cd "${srcdir}"
for pver in {2,3}; do
msg "Python ${pver} test for ${CARCH}"
cd "${srcdir}/python${pver}-build-${CARCH}"
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python${pver} setup.py pytest || true
done
}
package_python3-babel() {
depends=("${MINGW_PACKAGE_PREFIX}-python3-pytz")
cd "${srcdir}/python${pver}-build-${CARCH}"
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
install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE"
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX})
# fix python command in files
for _f in "${pkgdir}${MINGW_PREFIX}"/bin/*.py; do
sed -e "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i ${_f}
done
}
package_python2-babel() {
depends=("${MINGW_PACKAGE_PREFIX}-python2-pytz")
cd "${srcdir}/python${pver}-build-${CARCH}"
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" --optimize=1 --skip-build
install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE"
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX})
# fix python command in files
for _f in "${pkgdir}${MINGW_PREFIX}"/bin/*.py; do
sed -e "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i ${_f}
done
for f in pybabel; do
mv "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,2}.exe
if [ -f "${pkgdir}${MINGW_PREFIX}"/bin/${f}.exe.manifest ]; then
mv "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,2}.exe.manifest
sed -e "s|${f}|${f}2|g" -i "${pkgdir}${MINGW_PREFIX}"/bin/${f}2.exe.manifest
fi
mv "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,2}-script.py
done
}
package_mingw-w64-i686-python2-babel() {
install=${_realname}2-${CARCH}.install
package_python2-babel
}
package_mingw-w64-i686-python3-babel() {
install=${_realname}3-${CARCH}.install
package_python3-babel
}
package_mingw-w64-x86_64-python2-babel() {
install=${_realname}2-${CARCH}.install
package_python2-babel
}
package_mingw-w64-x86_64-python3-babel() {
install=${_realname}3-${CARCH}.install
package_python3-babel
}