summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4dd9c43b718daad2fc39eee2006c78fd8c9d3a91 (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
64
65
# Maintainer: Martin Rys <https://rys.rs/contact> | Toss a coin on https://rys.rs/donate
# Previous maintainers:
#   George Rawlinson <grawlinson@archlinux.org>
#   Felix Yan <felixonmars@archlinux.org>

pkgname=python-pytest-pylint
pkgver=0.21.0
pkgrel=3
pkgdesc='pytest plugin to check source code with pylint'
arch=('any')
url='https://github.com/carsongee/pytest-pylint'
license=('MIT')
depends=(
	'python'
	'python-pytest'
	'python-pylint'
	'python-toml'
	'python-tomli'
)
makedepends=(
	'git'
	'python-build'
	'python-installer'
	'python-setuptools'
	'python-wheel'
)
_commit='229b64fcef27c5ac436f3b3a3d0ca07df0bf8b52'
source=("${pkgname}::git+${url}#commit=${_commit}")
b2sums=('9d68725b60c7723e7c014212a0015c2fd2aad7099b271b922b41fdffd3b54225a4b3fd08c4a8aeb9354e10264b43e48df35093f2e7678af731ab7b7636f41e4b')

pkgver() {
	cd "${pkgname}"
	git describe --tags | sed -e 's/^v//'
}

prepare() {
	cd "$pkgname"
	# pytest-runner is certainly not required to build a wheel...
	sed -e '/pytest-runner/d' -i setup.py
}

build() {
	cd "${pkgname}"
	python -m build --wheel --no-isolation
}

check() {
	cd "${pkgname}"
	# install to temporary location, as importlib is used
	python -m installer --destdir=test_dir dist/*.whl
	local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
	export PYTHONPATH="test_dir/${site_packages}:${PYTHONPATH}"
	pytest -vv --ignore test_dir/
}

package() {
	cd "${pkgname}"
	python -m installer --destdir="${pkgdir}" dist/*.whl
	# symlink license file
	local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
	install -d "${pkgdir}/usr/share/licenses/${pkgname}"
	ln -s \
		"${site_packages}/pytest_pylint-${pkgver}.dist-info/LICENSE" \
		"${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}