arch-pkgs/python-commitizen/PKGBUILD

72 lines
1.9 KiB
Bash

# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Jayson Reis <santosdosreis@gmail.com>
_pkgname=commitizen
pkgname=python-commitizen
pkgver=2.20.4
pkgrel=2
pkgdesc="A tool for enforcing descriptive commit messages and version/changelog management"
arch=('any')
url="https://github.com/commitizen-tools/commitizen"
license=('MIT')
depends=(
'python'
'python-questionary'
'python-decli'
'python-colorama'
'python-termcolor'
'python-packaging'
'python-tomlkit'
'python-jinja'
'python-pyaml'
'python-argcomplete'
'python-prompt_toolkit'
)
makedepends=(
'python-install'
'python-build'
'python-poetry-core'
)
provides=('cz' 'git-cz')
conflicts=('nodejs-commitizen' 'commitizen-go')
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
sha512sums=('d649455d67065c0469f7a962e01383c1fce02424931efaf27211eef0ea65ac329e7286014958659b6642b92565320e3addb878c955248c1e1c89a5f611cd7fb6')
b2sums=('df4550788f4a35043cd862850c9391906c119cd4de0fe6625a86a6edd7b34b343cf515d106fc7e7e21f2c915aeb723cb3cbf7bfecca2073ef6e368c2c0d598f9')
prepare () {
cd "$_pkgname-$pkgver"
# create completions
mkdir completions
register-python-argcomplete --shell bash cz > completions/bash
register-python-argcomplete --shell fish cz > completions/fish
}
build() {
cd "$_pkgname-$pkgver"
python -m build \
--wheel \
--skip-dependency-check \
--no-isolation
}
package() {
cd "$_pkgname-$pkgver"
python -m install \
--optimize=1 \
--destdir="$pkgdir" \
dist/*.whl
# fix permissions issue
find "$pkgdir/usr/bin" -type f -exec chmod 0755 {} +
# license
install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
# shell completions
install -vDm644 completions/bash "$pkgdir/usr/share/bash-completion/completions/cz"
install -vDm644 completions/fish "$pkgdir/usr/share/fish/vendor_completions.d/cz.fish"
}