2022-11-23 23:18:40 +01:00

74 lines
2.1 KiB
Plaintext

# Contributor: Galen Abell <galen@galenabell.com>
# Maintainer: Galen Abell <galen@galenabell.com>
pkgname=pre-commit
pkgver=2.20.0
pkgrel=1
pkgdesc="framework for managing and maintaining multi-language pre-commit hooks"
url="https://pre-commit.com"
arch="noarch"
license="MIT"
depends="
python3
py3-cfgv
py3-identify
py3-nodeenv
py3-yaml
py3-toml
py3-virtualenv
py3-platformdirs
"
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
$pkgname-fix-check.patch::https://github.com/pre-commit/pre-commit/commit/bc96b0bcf688f8c5e6494e8bcf67ef72780f4c20.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="
b1da558a0e5d8f2f655427089f1d0b11b01ad7513ece7a0b3b67c33529cf3584edba558c78704e6da6ca18876b1d6c0fa8698e01fd7c2439b8d4dc0a93961e52 pre-commit-2.20.0.tar.gz
6c4ef9d9dff0a6b0edbba254d026112a3e269930f145399d29bb48c18a4e1fcca8c7e9125541c1bb9cfc7e5fc8c484c0de4b143f4ab8b29b1098ecc3197602da fix-importlib-metadata.patch
6925efa9fc3afb73ded417e52cbbfffa5da7213373fae66204d5413b7bfce3f1437a17ffd9bd2cf6913b7c9e5c6f31285f20b1462f81cf0341c5a8bcf0327e21 pre-commit-fix-check.patch
"