diff --git a/python-html5lib/PKGBUILD b/python-html5lib/PKGBUILD index 8dd58a54e..32535dd1d 100644 --- a/python-html5lib/PKGBUILD +++ b/python-html5lib/PKGBUILD @@ -1,31 +1,59 @@ pkgbase=python-html5lib pkgname=('python2-html5lib' 'python3-html5lib') -pkgver=0.999999999 +pkgver=1.0.1 pkgrel=3 arch=('any') url="https://github.com/html5lib" license=('MIT') -makedepends=('python2' 'python3' 'unzip' 'python2-setuptools' 'python3-setuptools' - 'python2-webencodings' 'python3-webencodings' 'python2-six' 'python3-six') -source=("https://github.com/html5lib/html5lib-python/archive/${pkgver}.tar.gz" - 'LICENSE') -sha256sums=('05c0f1ba235776060ded5093c365483d50deacdd7cabc57b6996d6e2480a4626' - '89807acf2309bd285f033404ee78581602f3cd9b819a16ac2f0e5f60ff4a473e') +makedepends=('python'{2,3}'-setuptools' 'python'{2,3}'-webencodings') +checkdepends=('python3-six' 'python2-six' 'python3-pytest-expect' 'python2-pytest-expect' + 'python3-lxml' 'python2-lxml' 'python3-mock' 'python2-mock') +_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") +sha256sums=('fabbebd6a55d07842087f13849076eeed350aa8bb6c9ec840f6a6aba9388db06' + 'cb261423c644b3469ac66926e290060b481371d0952995d270492fc761d0209a') + +prepare() { + cd "${srcdir}"/html5lib-python-${pkgver} + + rmdir html5lib/tests/testdata + ln -sfT ../../../html5lib-tests-${_test_commit} html5lib/tests/testdata +} + +build() { + cd "${srcdir}"/html5lib-python-${pkgver} + + python3 setup.py build + python2 setup.py build +} + +check() { + cd "${srcdir}"/html5lib-python-${pkgver} + + py.test + py.test2 +} package_python3-html5lib() { -pkgdesc="A Python HTML parser/tokenizer based on the WHATWG HTML5 spec" -depends=('python3' 'python3-six' 'python3-webencodings') - cd html5lib-python-${pkgver} + pkgdesc="A Python HTML parser/tokenizer based on the WHATWG HTML5 spec" + depends=('python3' 'python3-six' 'python3-webencodings') + optdepends=('python3-lxml: lxml treebuilder' + 'python3-genshi: genshi treewalker') + cd "${srcdir}"/html5lib-python-${pkgver} - python3 setup.py install --root="${pkgdir}" - install -Dm755 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + python3 setup.py install --root="${pkgdir}" --optimize=1 --skip-build + install -Dm755 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE } package_python2-html5lib() { -depends=('python2' 'python2-six' 'python2-webencodings') -pkgdesc="A Python2 HTML parser/tokenizer based on the WHATWG HTML5 spec" - cd html5lib-python-${pkgver} + pkgdesc="A Python2 HTML parser/tokenizer based on the WHATWG HTML5 spec" + depends=('python2' 'python2-six' 'python2-webencodings') + optdepends=('python2-lxml: lxml treebuilder' + 'python2-genshi: genshi treewalker') + cd "${srcdir}"/html5lib-python-${pkgver} - python2 setup.py install --root=${pkgdir} - install -Dm755 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + python2 setup.py install --root="${pkgdir}" --optimize=1 --skip-build + install -Dm755 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE } +