Files
MINGW-packages/mingw-w64-python-html5lib/PKGBUILD
2017-06-17 23:17:56 +03:00

93 lines
3.4 KiB
Bash

# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>
_realname=html5lib
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=0.999999999
pkgrel=2
arch=('any')
pkgdesc="A Python HTML parser/tokenizer based on the WHATWG HTML5 spec (mingw-w64)"
url="https://github.com/html5lib"
license=('MIT')
makedepends=("${MINGW_PACKAGE_PREFIX}-python2" "${MINGW_PACKAGE_PREFIX}-python3"
"unzip"
"${MINGW_PACKAGE_PREFIX}-python3-webencodings"
"${MINGW_PACKAGE_PREFIX}-python2-webencodings")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python3-six" "${MINGW_PACKAGE_PREFIX}-python2-six"
"${MINGW_PACKAGE_PREFIX}-python2-pytest" "${MINGW_PACKAGE_PREFIX}-python3-pytest"
"${MINGW_PACKAGE_PREFIX}-python3-lxml" "${MINGW_PACKAGE_PREFIX}-python2-lxml"
"${MINGW_PACKAGE_PREFIX}-python3-mock" "${MINGW_PACKAGE_PREFIX}-python2-mock")
source=("${_realname}-${pkgver}.tar.gz::https://github.com/html5lib/html5lib-python/archive/${pkgver}.tar.gz"
LICENSE)
sha256sums=('05c0f1ba235776060ded5093c365483d50deacdd7cabc57b6996d6e2480a4626'
'89807acf2309bd285f033404ee78581602f3cd9b819a16ac2f0e5f60ff4a473e')
prepare() {
cd "${srcdir}"
for pver in {2,3}; do
rm -rf python${pver}-build-${CARCH} | true
cp -r "${_realname}-python-${pkgver}" "python${pver}-build-${CARCH}"
done
}
# Note that build() is sometimes skipped because it's done in
# the packages setup.py install for simplicity if you can do so.
# but sometimes, you want to do a check before install which would
# also trigger the build.
build() {
for pver in {2,3}; do
msg2 "Python ${pver} build for ${CARCH}"
cd "${srcdir}/python${pver}-build-${CARCH}"
${MINGW_PREFIX}/bin/python${pver} setup.py build
done
}
check() {
#A few tests fail but most succede.
for pver in {2,3}; do
msg2 "Python ${pver} check for ${CARCH}"
cd ${srcdir}/python${pver}-build-${CARCH}/html5lib/tests
${MINGW_PREFIX}/bin/nosetests${pver} || true
done
}
package_python3-html5lib() {
depends=("${MINGW_PACKAGE_PREFIX}-python3"
"${MINGW_PACKAGE_PREFIX}-python3-six"
"${MINGW_PACKAGE_PREFIX}-python3-webencodings")
cd "${srcdir}/python3-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 -Dm755 $srcdir/LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE
}
package_python2-html5lib() {
depends=("${MINGW_PACKAGE_PREFIX}-python2"
"${MINGW_PACKAGE_PREFIX}-python2-six"
"${MINGW_PACKAGE_PREFIX}-python2-webencodings")
cd "${srcdir}/python2-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 -Dm755 $srcdir/LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE
}
package_mingw-w64-i686-python2-html5lib() {
package_python2-html5lib
}
package_mingw-w64-i686-python3-html5lib() {
package_python3-html5lib
}
package_mingw-w64-x86_64-python2-html5lib() {
package_python2-html5lib
}
package_mingw-w64-x86_64-python3-html5lib() {
package_python3-html5lib
}