summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 27acc39092670f2518da50ba03c4120f81bc3c22 (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
# Maintainer: Tyler Veness <calcmogul at gmail dot com>

pkgname=python-wpiformat-git
pkgver=2024.48
pkgrel=1
pkgdesc="Linters and formatters for ensuring WPILib's source code conforms to its style guide"
arch=('i686' 'x86_64')
url="https://github.com/wpilibsuite/styleguide"
license=('custom=FRC-BSD')
depends=('clang' 'python-black' 'python-gersemi' 'python-isort' 'python-regex')
makedepends=('python-build' 'python-installer' 'python-pytest')
provides=('python-wpiformat')
conflicts=('python-wpiformat')
source=(git+https://github.com/wpilibsuite/styleguide)
md5sums=('SKIP')

pkgver() {
  cd "${srcdir}/styleguide"
  year=$(date +%Y)
  echo $year.$(git rev-list --count --after="main@{$(($year - 1))-01-01}" main)
}

build() {
  cd "${srcdir}/styleguide/wpiformat"
  python -m build --wheel
}

check() {
  cd "${srcdir}/styleguide/wpiformat"
  pytest
}

package() {
  cd "${srcdir}/styleguide/wpiformat"
  pip install clang-format clang-tidy --no-deps --root ${pkgdir} --ignore-installed
  pip install dist/wpiformat-*.whl --no-deps --root ${pkgdir} --ignore-installed

  # Remove duplicates already provided by clang package
  cd "${pkgdir}/usr/bin"
  rm clang-format clang-tidy git-clang-format
}