aboutsummaryrefslogtreecommitdiffstats
path: root/testing/pre-commit/APKBUILD
blob: 4858387d3aa2a2610d9f93d60c771e47a8225384 (plain) (blame)
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
66
67
68
69
70
# Contributor: Galen Abell <galen@galenabell.com>
# Maintainer: Galen Abell <galen@galenabell.com>
pkgname=pre-commit
pkgver=2.16.0
pkgrel=0
pkgdesc="framework for managing and maintaining multi-language pre-commit hooks"
url="https://pre-commit.com"
arch="noarch !mips64" # blocked by npm
license="MIT"
depends="
	python3
	py3-cfgv
	py3-identify
	py3-nodeenv
	py3-yaml
	py3-toml
	py3-virtualenv
	"
makedepends="py3-setuptools"
checkdepends="
	py3-pytest
	py3-pytest-env
	py3-re-assert
	py3-distlib
	ruby
	npm
	git
	"
options="net"
source="$pkgname-$pkgver.tar.gz::https://github.com/pre-commit/pre-commit/archive/refs/tags/v$pkgver.tar.gz
	fix-importlib-metadata.patch
	"

prepare() {
	default_prepare
	sed -i "s|%%PKGVER%%|'$pkgver'|g" pre_commit/constants.py
}

build() {
	python3 setup.py build
}

check() {
	export PYTHONPATH="."

	# setup for some of the integration tests
	git init
	git config user.email "test@alpinelinux.org"
	git config user.name "Alpine Linux"
	export GIT_AUTHOR_NAME="Alpine Linux"
	export GIT_COMMITTER_NAME="Alpine Linux"
	export GIT_AUTHOR_EMAIL="test@alpinelinux.org"
	export GIT_COMMITTER_EMAIL="test@alpinelinux.org"
	export PRE_COMMIT_NO_CONCURRENCY=1

	# skip some of the tests since they depend on non-packaged tools
	PYTHONPATH="$PWD"/build/lib pytest -v \
		--ignore tests/repository_test.py \
		--deselect tests/languages/ruby_test.py::test_install_ruby_with_version \
		--deselect tests/commands/install_uninstall_test.py::test_installed_from_venv
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="
c9eb14a40e25e8408c2b2b5687eba4908d609bbb7bcf58a0153326696d272bca555156fd75f3ec5f0dec219aeeb4084df77f329f47cf190e40052c11e92fe185  pre-commit-2.16.0.tar.gz
6c4ef9d9dff0a6b0edbba254d026112a3e269930f145399d29bb48c18a4e1fcca8c7e9125541c1bb9cfc7e5fc8c484c0de4b143f4ab8b29b1098ecc3197602da  fix-importlib-metadata.patch
"