summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 24d36303c49e476065d0fd1f7e48a205eb056546 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Maintainer: Drew Metzger <aur at unexceptional dot net>

pkgname=greatfet-git
pkgver=2024.0.1
pkgrel=1
pkgdesc="GreatFET firmware and host software"
arch=('any')
url="https://github.com/greatscottgadgets/greatfet"
license=(BSD)
depends=(
  'ipython' 
  'python-pyusb' 
  'python-future' 
  'python-pygreat' 
  'python-cmsis-svd-git' 
  'python-pyfwup'
)
makedepends=(
  'python-build'
  'python-installer'
  'python-pyproject-patcher'
  'python-setuptools'
  'python-wheel'
)
provides=('greatfet')
source=("git+${url}")
sha1sums=('SKIP')
install=greatfet-git.install
_gitname=greatfet

pkgver() {
  cd $_gitname
  echo $(git describe --always --tags $(git rev-list --tags --max-count=1) | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g')
}

prepare() {
  # since the latest release is outside of the main branch for some reason...
  cd $_gitname
  git checkout --quiet "v${pkgver}"

  echo >&2 'Pinning version number'
  export pkgver
  python << 'EOF'
from pyproject_patcher import patch_in_place
with patch_in_place('host/pyproject.toml') as toml:
    toml.set_project_version_from_env('pkgver')
    toml.tools.setuptools_git_versioning.remove()
EOF
}

build() {
  python -m build --wheel --no-isolation "${_gitname}/host"
}

package() {
  install -D -m644 "${srcdir}/${_gitname}/host/util/54-greatfet.rules" "${pkgdir}/usr/lib/udev/rules.d/54-greatfet.rules"
  python -I -m installer --destdir="${pkgdir}" $srcdir/$_gitname/host/dist/*.whl
}

# vim:set ts=2 sw=2 et: