70 lines
2.5 KiB
Bash

# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Eli Schwartz <eschwartz@archlinux.org>
# Maintainer: Jelle van der Waa <jelle@archlinux.org>
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
# Contributor: Erol V. Aktay <e.aktay@gmail.com>
pkgbase=python-html5lib
pkgname=('python2-html5lib' 'python-html5lib')
pkgver=1.0.1
pkgrel=8
arch=('any')
url="https://github.com/html5lib"
license=('MIT')
_deps=('six' 'webencodings')
makedepends=('python-setuptools' 'python2-setuptools' "${_deps[@]/#/python-}" "${_deps[@]/#/python2-}")
_checkdeps=('pytest' 'pytest-expect' 'lxml' 'mock')
checkdepends=("${_checkdeps[@]/#/python-}" "${_checkdeps[@]/#/python2-}")
_test_commit=c305da74fae50fb018870de7a042da36c1a93b65
source=("$pkgbase-$pkgver.tar.gz::https://github.com/html5lib/html5lib-python/archive/${pkgver}.tar.gz"
"https://github.com/html5lib/html5lib-tests/archive/${_test_commit}.tar.gz"
pytest4.patch)
sha256sums=('fabbebd6a55d07842087f13849076eeed350aa8bb6c9ec840f6a6aba9388db06'
'cb261423c644b3469ac66926e290060b481371d0952995d270492fc761d0209a'
'6b627d2490d0cd16a801ec2787b8ce643f66d8ddf780fee9ff5268c8126d4f8c')
prepare() {
cd "${srcdir}"/html5lib-python-${pkgver}
# From https://github.com/html5lib/html5lib-python/pull/429
patch -p1 -i ../pytest4.patch
rmdir html5lib/tests/testdata
ln -sfT ../../../html5lib-tests-${_test_commit} html5lib/tests/testdata
}
build() {
cd "${srcdir}"/html5lib-python-${pkgver}
python setup.py build
python2 setup.py build
}
check() {
cd "${srcdir}"/html5lib-python-${pkgver}
py.test
py.test2
}
package_python-html5lib() {
pkgdesc="A Python HTML parser/tokenizer based on the WHATWG HTML5 spec"
depends=("${_deps[@]/#/python-}")
optdepends=('python-lxml: lxml treebuilder'
'python-genshi: genshi treewalker')
cd "${srcdir}"/html5lib-python-${pkgver}
python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}
package_python2-html5lib() {
pkgdesc="A Python2 HTML parser/tokenizer based on the WHATWG HTML5 spec"
depends=("${_deps[@]/#/python2-}")
optdepends=('python2-lxml: lxml treebuilder'
'python2-genshi: genshi treewalker')
cd "${srcdir}"/html5lib-python-${pkgver}
python2 setup.py install --root="${pkgdir}" --optimize=1 --skip-build
install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}