summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fa42d872ba66a0be3461bc78b35b5b25699234bd (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
# Maintainer: Johannes Simon Piermeier <pierm.jo+github-public@gmail.com>

pkgname=discord-hushd-git
pkgver=0.1.1.r0.gd2af2a2
pkgrel=1
pkgdesc='Systemd daemon and CLI to mute/deafen Discord via RPC (git version)'
arch=('any')
url='https://gitlab.com/johannes-piermeier/discord-hushd'
license=('MIT')
provides=('discord-hushd')
conflicts=('discord-hushd')
depends=(
  'python'
  'python-requests'
  'python-flask'
  'python-pypresence'
  'python-tomli-w'
)
makedepends=('git' 'python-build' 'python-installer' 'python-poetry-core')
source=("git+$url.git#branch=main")
sha256sums=('SKIP')

pkgver() {
  cd "$srcdir/discord-hushd"
  # Prefer annotated tags like v0.1.0; fall back if none exist
  if git describe --long --tags --match 'v*' >/dev/null 2>&1; then
    git describe --long --tags --match 'v*' \
      | sed 's/^v//; s/-/.r/; s/-/./'
  else
    printf "0.r%s.g%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
  fi
}

build() {
  cd "$srcdir/discord-hushd"
  python -m build --wheel --no-isolation
}

package() {
  cd "$srcdir/discord-hushd"
  python -m installer --destdir="$pkgdir" dist/*.whl

  # systemd user unit
  install -Dm644 "systemd/discord-hushd.service" \
    "$pkgdir/usr/lib/systemd/user/discord-hushd.service"

  # license
  install -Dm644 LICENSE \
    "$pkgdir/usr/share/licenses/${pkgname}/LICENSE"
}