description='A Python HTML parser/tokenizer based on the WHATWG HTML5 spec'
url='https://github.com/html5lib'

packager="spiky <spiky@nutyx.org>"
contributors="Tnut"

name=python-html5lib
_name="html5lib"
alias=(${_name})

version=1.1
release=2

makedepends=(python-setuptools python-wheel python-six python-webencodings)

PKGMK_KEEP_SOURCES="no"

source=(https://files.pythonhosted.org/packages/source/h/html5lib/html5lib-$version.tar.gz
        pytest-6-compat.patch html5lib-mock-stdlib.patch
        html5lib_pytest74.patch)
prepare() {
  cd ${_name}-$version
  patch -p1 -i ../pytest-6-compat.patch
  patch -p1 -i ../html5lib_pytest74.patch
  patch -p1 -i ../html5lib-mock-stdlib.patch
 
}

build() {
  cd ${_name}-$version

  pip3 wheel -w dist \
    --no-build-isolation \
    --no-deps $PWD
  pip3 install --no-index \
    --find-links dist \
    --no-cache-dir    \
    --no-user         \
    --root=$PKG       \
    ${_name}

 find $PKG -type d -name vendor -o -name tests |xargs rm -rf 
}
