summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bdb7e775258b697eb30f4c6e14f4585d53f1cddd (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Maintainer: Jonas Malaco <jonas@protocubo.io>
# Contributor: Adam Rutkowski
# Contributor: Fabio Loli
# Contributor: Sergey Kasmy

pkgname=liquidctl-git
pkgver=1.8.1.r113.df547dc
pkgrel=1
pkgdesc='Cross-platform tool and drivers for liquid coolers and other devices'
arch=('any')
url='https://github.com/liquidctl/liquidctl'
license=('GPL3')
depends=(
  i2c-tools
  python
  python-colorlog
  python-docopt
  python-hidapi
  python-pyusb
  python-setuptools
)
makedepends=(
  python-build
  python-installer
  python-setuptools-scm
)
checkdepends=(
  python-pytest
)
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=(
  "$pkgname::git+https://github.com/liquidctl/liquidctl.git#branch=main"
)
sha256sums=(
  SKIP
)

pkgver() {
  cd $pkgname

  printf "%s" "$(git describe --long --abbrev=7 | sed 's/\([^-]*-\)g/r\1/;s/-/./g;s/^v//')"
}

build() {
  cd $pkgname

  python -m build --wheel --no-isolation
}

check() {
  cd $pkgname

  mkdir -p runtime
  XDG_RUNTIME_DIR=runtime python -m pytest

  python -m liquidctl list --verbose
}

package() {
  cd $pkgname

  python -m installer --destdir="$pkgdir" dist/liquidctl-"$(python -m setuptools_scm)"-*.whl

  # documentation
  install -Dm644 -t "$pkgdir"/usr/share/man/man8 liquidctl.8
  install -dm 755 "$pkgdir"/usr/share/doc/$pkgname
  cp -r -a --no-preserve=ownership docs/* "$pkgdir"/usr/share/doc/$pkgname

  # device access
  install -Dm644 -t "$pkgdir"/usr/lib/udev/rules.d/ extra/linux/71-liquidctl.rules

  # completions
  install -Dm644 extra/completions/liquidctl.bash "$pkgdir"/usr/share/bash-completion/completions/liquidctl

  # optional scripts, originally intended as examples, but that may be
  # useful in some scenarios (note: versioned separately from liquidctl):
  # install -D extra/yoda "$pkgdir"/usr/bin/liquidctl-yoda
  # install -D extra/liquiddump "$pkgdir"/usr/bin/liquidctl-dump
  # install -D extra/prometheus-liquidctl-exporter "$pkgdir"/usr/bin/prometheus-liquidctl-exporter
}