105 lines
3.8 KiB
Bash
105 lines
3.8 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=1.0.1
|
|
pkgrel=4
|
|
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}-python3-setuptools"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-setuptools"
|
|
"${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")
|
|
_test_commit=c305da74fae50fb018870de7a042da36c1a93b65
|
|
source=("${_realname}-${pkgver}.tar.gz::https://github.com/html5lib/html5lib-python/archive/${pkgver}.tar.gz"
|
|
"https://github.com/html5lib/html5lib-tests/archive/${_test_commit}.tar.gz")
|
|
sha256sums=('fabbebd6a55d07842087f13849076eeed350aa8bb6c9ec840f6a6aba9388db06'
|
|
'cb261423c644b3469ac66926e290060b481371d0952995d270492fc761d0209a')
|
|
|
|
prepare() {
|
|
cd "${srcdir}"
|
|
pushd "${_realname}-python-${pkgver}"
|
|
rm -rf html5lib/tests/testdata
|
|
cp -r "${srcdir}/html5lib-tests-${_test_commit}" html5lib/tests/testdata
|
|
popd
|
|
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.
|
|
msg2 "Python 2 check for ${CARCH}"
|
|
cd ${srcdir}/python2-build-${CARCH}
|
|
${MINGW_PREFIX}/bin/py.test2
|
|
|
|
msg2 "Python 3 check for ${CARCH}"
|
|
cd ${srcdir}/python3-build-${CARCH}
|
|
${MINGW_PREFIX}/bin/py.test
|
|
|
|
}
|
|
|
|
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 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 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
|
|
}
|