archrelease: copy trunk to community-any
[ArchLinux/community.git] / ruff / repos / community-x86_64 / PKGBUILD
blob950863571ea1b988ff5c0d56e9a1f5bce09da443
1 # Maintainer: David Runge <dvzrv@archlinux.org>
2 # Maintainer: Caleb Maclennan <caleb@alerque.com>
4 pkgbase=ruff
5 pkgname=($pkgbase python-$pkgbase)
6 pkgver=0.0.269
7 pkgrel=1
8 pkgdesc='An extremely fast Python linter, written in Rust'
9 arch=(x86_64)
10 url="https://github.com/charliermarsh/$pkgname"
11 license=(MIT)
12 depends=(
13   gcc-libs
14   glibc
16 makedepends=(
17   cargo
18   maturin
19   python-installer
21 options=(!lto)
22 _archive="$pkgname-$pkgver"
23 source=($url/archive/refs/tags/v$pkgver/$_archive.tar.gz)
24 sha512sums=('fba0d3fddb7e2ff68bf78f482a270b709a24ba4fc92d8f97e496433f569639b7c93a2bc350e86081937a4fc618c07d4d2b29d460359f6c88f820d83611317fae')
25 b2sums=('529d47be60814a65f17764cc357e784f162bddd90a3bf4d82c3d9aa718acdfca565d4db64ac6eb2dba23766ba2b61efeed18dbb5b781f35d4bbd035c0688514c')
27 prepare() {
28   cd "$_archive"
29   cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
32 build() {
33   cd "$_archive"
34   maturin build --locked --release --all-features --target "$CARCH-unknown-linux-gnu" --strip
37 check() {
38   cd "$_archive"
39   cargo test -p ruff_cli --frozen --all-features
42 _package_common() {
43   install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE
44   install -Dm0644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
47 package_ruff() {
48   cd "$_archive"
49   _package_common
50   local _target="target/$CARCH-unknown-linux-gnu/release/ruff"
51   install -Dm0755 -t "$pkgdir/usr/bin/" "$_target"
52   $_target --generate-shell-completion bash | install -Dm0644 /dev/stdin "$pkgdir/usr/share/bash-completion/completions/$pkgname.bash"
53   $_target --generate-shell-completion fish | install -Dm0644 /dev/stdin "$pkgdir/usr/share/fish/vendor_completions.d/$pkgname.fish"
54   $_target --generate-shell-completion zsh  | install -Dm0644 /dev/stdin "$pkgdir/usr/share/zsh/site-functions/_$pkgname"
57 package_python-ruff() {
58   cd "$_archive"
59   _package_common
60   depends=(python "$pkgbase")
61   python -m installer -d "$pkgdir" target/wheels/*.whl
62   rm -rf "$pkgdir/usr/bin"