# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-bleach
pkgver=5.0.1
pkgrel=3
pkgdesc="whitelist-based HTML sanitizing library"
url="https://github.com/mozilla/bleach"
arch="noarch"
license="Apache-2.0"
depends="python3 py3-html5lib"
makedepends="py3-setuptools"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://pypi.python.org/packages/source/b/bleach/bleach-$pkgver.tar.gz
	0002-no_vendored_html5lib.patch
	"
builddir="$srcdir/bleach-$pkgver"

# secfixes:
#   3.3.0-r0:
#     - CVE-2021-23980
#   3.1.2-r0:
#     - CVE-2020-6816
#   3.1.1-r0:
#     - CVE-2020-6802

build() {
	rm -rf bleach/_vendor
	python3 setup.py build
}

check() {
	# test_clean.py: https://github.com/mozilla/bleach/issues/611
	# test_parse_shim.py: https://github.com/mozilla/bleach/issues/707
	python3 -m pytest \
		--deselect tests/test_clean.py::test_uri_value_allowed_protocols \
		--deselect tests/test_parse_shim.py::test_urlparse
}

package() {
	python3 setup.py install --skip-build --root="$pkgdir"
}

sha512sums="
6c8e80eaf6db6f0e6d9066f3443192f44c489e079945b6d11b11e7eb270ea865011019e05d43c7896262dc11ca168e697630d9da8dca9f5bb48f0e2161fda6c8  bleach-5.0.1.tar.gz
f70c86bac63ed10ca8d822d8ef39290a778861f7b762bdd5482af752352e3a6c1abb5eb4cf2f107f92c2a221dbf2d76f323fb45c372b116c7d8316491adb2917  0002-no_vendored_html5lib.patch
"
