blob: 5926cce78152d6770a37c27efd301a7673a61a9c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# Contributor: omni <omni+alpine@hack.org>
# Maintainer: omni <omni+alpine@hack.org>
pkgname=py3-adblock
_pkgname=python-adblock
pkgver=0.5.0
pkgrel=1
pkgdesc="Python wrapper for Brave's adblocking library"
url="https://github.com/ArniDagur/python-adblock"
arch="all !mips64 !s390x !riscv64" # limited by rust/cargo
arch="$arch !ppc64le" # limited by ring crate
license="Apache-2.0 MIT"
makedepends="
py3-setuptools
cargo
maturin
openssl1.1-compat-dev
"
checkdepends="
py3-pytest
py3-pip
"
subpackages="$pkgname-doc:doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/ArniDagur/python-adblock/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"
build() {
export RUSTFLAGS="-C target-feature=-crt-static"
maturin build --release --strip --manylinux off \
--cargo-extra-args="--locked --all-features"
# (I couldn't word it better than the Void Linux package maintainer: )
# 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 target/wheels/adblock-"$pkgver"-*.whl \
target/wheels/adblock-"$pkgver"-py3-none-any.whl
}
check() {
local python_path="$(python3 -c \
'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
mkdir -vp testdir
export PYTHONPATH="testdir$python_path:$PYTHONPATH"
PIP_CONFIG_FILE='/dev/null' pip install --isolated \
--root="testdir" \
--ignore-installed \
--no-deps target/wheels/adblock-"$pkgver"-py3-none-any.whl
pytest -v -k 'not test_version_numbers_all_same'
}
package() {
install -Dm755 target/release/libadblock.so -t "$pkgdir/usr/lib"
PIP_CONFIG_FILE='/dev/null' pip install --isolated \
--root="$pkgdir" \
--ignore-installed \
--no-deps target/wheels/adblock-"$pkgver"-py3-none-any.whl
install -Dm0644 LICENSE-APACHE "$pkgdir/usr/share/licenses/$pkgname/LICENSE-APACHE"
install -Dm0644 LICENSE-MIT "$pkgdir/usr/share/licenses/$pkgname/LICENSE-MIT"
}
sha512sums="5ae9c979a769fbfc89c26d2c5c40a1712f0573707840b3bf35acf7bd15d2c22f08dfdbd384ab0e886568aee686ef5da3ab5f1cb73bf66491831be24977e6173c py3-adblock-0.5.0.tar.gz"
|