summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 464903a9c4cd09bf4798382c37380a0d82407f90 (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
# Maintainer: Bao Trinh <qubidt at gmail dot com>

pkgname=python-darkgraylib
_pkgname="${pkgname#python-}"
pkgver=1.2.1
pkgrel=1
pkgdesc='Filter linter messages from various Python linters to only those which were caused by recent changes to the code base being linted'
arch=(any)
url="https://github.com/akaihola/darkgraylib"
license=("BSD-3-Clause")
depends=(
	'python'
	'python-toml'
	'python-click'
)
makedepends=(
	'git'
	'python-build'
	'python-installer'
	'python-wheel'
	'python-setuptools'
)
checkdepends=(
	'python-pytest'
	'python-pygments'
	'python-pytest-kwparametrize'
)
optdepends=('python-pygments: syntax highlighting')
source=("${pkgname}::git+${url}.git#tag=v${pkgver}")
sha256sums=('f93150231c79d930a0b66bda2545cbc0f9c51258fb46b51d7464267f5c713526')

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

check() {
	cd "${pkgname}"
	local site_packages
	[[ ! -d tmp_install ]] || rm -rf tmp_install
	python -m installer -d tmp_install dist/"${_pkgname}-${pkgver}"-*.whl
	site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
	export PYTHONPATH="${PWD}/tmp_install/${site_packages}:${PYTHONPATH}"
	pytest -v --import-mode=importlib "src/${_pkgname}"
}

package() {
	cd "${pkgname}"
	python -m installer -d "${pkgdir}" dist/*.whl
	install -Dm644 "LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
	install -Dm644 "README.rst" -t "${pkgdir}/usr/share/doc/${pkgname}"
}