summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 00a38f8cdd8a853f4c022d5e614054dfe08a7281 (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=2023.28
pkgrel=2
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=('python-regex' 'python-black' 'clang')
makedepends=('python-tox')
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"
  tox
}

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
}