summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e3260ec326f577ebc9f97c8ee48af13c7f250026 (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
# Maintainer: aur.chaotic.cx

_pkgname="libinput-gestures-qt"
pkgname="$_pkgname"
pkgver=0.4
pkgrel=1
pkgdesc="Qt-based GUI for libinput-gestures"
arch=('any')
url="https://github.com/OneAdder/libinput_gestures_qt"
license=('GPL3')

depends=(
  'libinput-gestures'
  'python-pyqt5'
  'qt5-tools'
)
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel'
)

provides=('libinput_gestures_qt')
conflicts=('libinput_gestures_qt')

if [ x"$pkgname" == x"$_pkgname" ] ; then
  # normal package
  _commit=''
  _pkgsrc="$_pkgname"
  source=("$_pkgsrc::git+$url.git#tag=v.$pkgver")
  sha256sums=('SKIP')
else
  # git package
  provides+=("$_pkgname")
  conflicts+=("$_pkgname")

  _pkgsrc="$_pkgname"
  source=("$_pkgsrc::git+$url.git")
  sha256sums=('SKIP')

  pkgver() {
    cd "$_pkgsrc"

    _regex='^\s*version='\''([0-9]+\.[0-9]+(\.[0-9]+)?)'\'',$'
    _file="setup.py"

    _line=$(
      grep -E "$_regex" "$_file" | head -1
    )
    _version=$(
      printf '%s' "$_line" | sed -E "s@$_regex@\1@"
    )

    git describe --long --tags --match="v.$_version" | sed -E 's/^v\.?//;s/([^-]*-g)/r\1/;s/-/./g'
  }
fi

prepare() {
  # don't install duplicate files
  sed -E '/local\/share/d' -i "$srcdir/$_pkgsrc/setup.py" 

  # fix .desktop file
  sed -E 's@^Icon=.*$@Icon=libinput-gestures-qt@g' \
    -i "$srcdir/$_pkgsrc/libinput_gestures_qt/logo/libinput-gestures-qt.desktop"
}

build() {
  cd "$_pkgsrc"
  python -m build --no-isolation --wheel
}

package() {
  cd "$_pkgsrc"
  python -m installer --destdir="$pkgdir" dist/*.whl
}