summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8ca89f6ae8aecb76dedb585bbd8ffd1057721192 (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
# Maintainer: Magi3r <magier dot mit dot f3erball at gmail dot com>
# Maintainer: Mohamed Amine Zghal (medaminezghal) <medaminezghal at outlook dot com>

_name=primp
pkgname=python-$_name
pkgver=1.2.0
pkgrel=1
pkgdesc='HTTP client that can impersonate web browsers.'
arch=('x86_64' 'aarch64')
url='https://github.com/deedy5/primp'
license=('MIT')
depends=('python' 'glibc' 'gcc-libs')
makedepends=('python-maturin' 'python-build' 'python-installer' 'python-wheel' 'mold')
checkdepends=('python-certifi' 'python-pytest' 'python-pytest-asyncio')
options=(!strip lto)
source=("$url/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('9211958f0f8145b39448ffdc66a1497a69d98a80642d57146566152bf950e223')

build(){
	cd "$srcdir"/$_name-$pkgver/crates/$_name-python
	export RUSTFLAGS="$RUSTFLAGS -Clink-arg=-fuse-ld=mold"
	python -m build --wheel --no-isolation
}

check(){
	local pytest_options=(
		-vv
		--disable-warnings
	)
	cd "$srcdir"/$_name-$pkgver/crates/$_name-python
	python -m venv --system-site-packages test-env
	test-env/bin/python -m installer dist/*.whl
	test-env/bin/python -P -m pytest "${pytest_options[@]}" tests
}

package(){
	cd "$srcdir"/$_name-$pkgver/crates/$_name-python
	python -m installer --destdir="$pkgdir" dist/*.whl

	# Symlink license file
	cd ../..
	local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
	install -d "$pkgdir"/usr/share/licenses/$pkgname
	ln -s "$site_packages"/$_name-$pkgver.dist-info/licenses/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}