New package: python3-adblock-0.4.2

Co-authored-by: Érico Rolim <erico.erc@gmail.com>
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>

Closes: #28396.
Closes: #28380.
Closes: #27490.
This commit is contained in:
Andrew J. Hesford 2021-02-01 13:50:32 +03:00
parent 1ca01c09a1
commit c03d7b477e

View file

@ -0,0 +1,46 @@
# Template file for 'python3-adblock'
pkgname=python3-adblock
version=0.4.2
revision=1
wrksrc="${pkgname/python3/python}-${version}"
build_style=python3-pep517
build_helper="rust"
hostmakedepends="maturin pkg-config cargo libressl-devel"
makedepends="libressl-devel python3-devel"
depends="python3"
checkdepends="python3-pytest"
short_desc="Brave's adblock library in Python"
maintainer="Andrew J. Hesford <ajh@sideband.org>"
license="Apache-2.0, MIT"
homepage="https://github.com/ArniDagur/python-adblock"
distfiles="${homepage}/archive/${version}.tar.gz"
checksum=06de6074e6cfe889fc0383cc929a5a2306570251c14e51abbfcedd328b83e0e9
case "$XBPS_TARGET_MACHINE" in
i686*) broken="compiler throws SIGABRT on the psl crate" ;;
esac
if [ "$CROSS_BUILD" ]; then
makedepends+=" rust-std"
export PYO3_CROSS_LIB_DIR="${XBPS_CROSS_BASE}/usr/lib"
export PYO3_CROSS_INCLUDE_DIR="${XBPS_CROSS_BASE}/usr/include"
fi
do_build() {
maturin build -o . --release --target "${RUST_TARGET}" --manylinux off
# Drop platform specifiers from the wheel; pip will refuse to install,
# e.g., an armv7l wheel on an aarch64 system even if the masterdir is
# armv7l. The wheel is correct; no need for name compatibility checks.
mv adblock-${version}-*.whl adblock-${version}-py3-none-any.whl
}
pre_check() {
# Tests require the compiled extension
cp target/${RUST_TARGET}/release/libadblock.so adblock/adblock.so
}
post_install() {
vlicense LICENSE-MIT
chmod 755 ${DESTDIR}/${py3_sitelib}/adblock/*.so
}